From c802bc1e792a35f5a89a97aedd353f1ff4972a5e Mon Sep 17 00:00:00 2001 From: botte Date: Sun, 11 Oct 2015 15:26:40 +0000 Subject: All modified files to support the UPDATE CRUD operation. Also a few general tweaks. Change-Id: Ife64166f2d572ee94f2c393af9ae66cfefa62551 --- .../com/cablelabs/vcpe/svc/svcmgr/EplService.java | 37 +++++++++++++++++++++- 1 file changed, 36 insertions(+), 1 deletion(-) (limited to 'svc') diff --git a/svc/svcmgr/src/main/java/com/cablelabs/vcpe/svc/svcmgr/EplService.java b/svc/svcmgr/src/main/java/com/cablelabs/vcpe/svc/svcmgr/EplService.java index f2c5343..5734374 100644 --- a/svc/svcmgr/src/main/java/com/cablelabs/vcpe/svc/svcmgr/EplService.java +++ b/svc/svcmgr/src/main/java/com/cablelabs/vcpe/svc/svcmgr/EplService.java @@ -65,7 +65,7 @@ public class EplService { return Response.status(Response.Status.BAD_REQUEST).build(); } - // Transfer EPLs I{P list to EVC + // Transfer EPLs IP list to EVC List uniIpList = new ArrayList(); if (epl.getUniHostIpList() != null && epl.getUniHostIpList().size() == 2) { uniIpList.add(epl.getUniHostIpList().get(0) ); @@ -111,7 +111,42 @@ public class EplService { //-------------------------------------------------------- { Dbg.p("\nUPDATING [" + epl.getId()+"]"); + if ( epl == null) { + return Response.status(Response.Status.BAD_REQUEST).build(); + } + + // Retrieve EVC associated with EPL + EvcClient evcClient = new EvcClient(); + Evc evc = evcClient.get(epl.getEvcId()); + + // Transfer EPLs mac list to EVC + List uniMacList = new ArrayList(); + if (epl.getUniHostMacList() != null && epl.getUniHostMacList().size() == 2) { + uniMacList.add(epl.getUniHostMacList().get(0) ); + uniMacList.add(epl.getUniHostMacList().get(1)); + } + else { + return Response.status(Response.Status.BAD_REQUEST).build(); + } + + // Transfer EPLs IP list to EVC + List uniIpList = new ArrayList(); + if (epl.getUniHostIpList() != null && epl.getUniHostIpList().size() == 2) { + uniIpList.add(epl.getUniHostIpList().get(0) ); + uniIpList.add(epl.getUniHostIpList().get(1)); + } + else { + return Response.status(Response.Status.BAD_REQUEST).build(); + } + + evc.setUniMacList(uniMacList); + evc.setUniIpList(uniIpList); + evc.setCosId(epl.getCos()); + + // send update request to EVC mgr + evc = evcClient.update(evc); + // update the EPL to our local repo EplRespositoryInMem.INSTANCE.update(epl); EplRespositoryInMem.INSTANCE.dump(0); return Response.ok().entity(epl).build(); -- cgit 1.2.3-korg