diff options
author | botte <b.otte@cablelabs.com> | 2015-10-11 15:26:40 +0000 |
---|---|---|
committer | botte <b.otte@cablelabs.com> | 2015-10-13 17:42:28 +0000 |
commit | c802bc1e792a35f5a89a97aedd353f1ff4972a5e (patch) | |
tree | 8038148375dfa63dedabe6c64dea6057d868d2be /svc/svcmgr/src | |
parent | b785b70b994f7910635195b40e8ce96ac5e0effe (diff) |
All modified files to support the UPDATE CRUD operation. Also a few general tweaks.
Change-Id: Ife64166f2d572ee94f2c393af9ae66cfefa62551
Diffstat (limited to 'svc/svcmgr/src')
-rw-r--r-- | svc/svcmgr/src/main/java/com/cablelabs/vcpe/svc/svcmgr/EplService.java | 37 |
1 files changed, 36 insertions, 1 deletions
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<String> uniIpList = new ArrayList<String>(); 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<String> uniMacList = new ArrayList<String>(); + 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<String> uniIpList = new ArrayList<String>(); + 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(); |