Merging stable/fluorine work onto Neon (master) 77/84177/1
authorDonald Hunter <donaldh@cisco.com>
Tue, 3 Sep 2019 15:53:17 +0000 (16:53 +0100)
committerDonald Hunter <donaldh@cisco.com>
Tue, 3 Sep 2019 15:53:17 +0000 (16:53 +0100)
Change-Id: I25e1e17eafcf7fd03e895d743ff6e742d7d4250f
Signed-off-by: Donald Hunter <donaldh@cisco.com>
88 files changed:
cisco-xr-driver/src/main/java/org/opendaylight/unimgr/mef/nrp/cisco/xr/common/helper/BandwidthProfileHelper.java
cisco-xr-driver/src/main/java/org/opendaylight/unimgr/mef/nrp/cisco/xr/l2vpn/activator/AbstractL2vpnActivator.java
cisco-xr-driver/src/main/java/org/opendaylight/unimgr/mef/nrp/cisco/xr/l2vpn/activator/L2vpnLocalConnectActivator.java
cisco-xr-driver/src/main/java/org/opendaylight/unimgr/mef/nrp/cisco/xr/l2vpn/activator/L2vpnP2pConnectActivator.java
cisco-xr-driver/src/main/java/org/opendaylight/unimgr/mef/nrp/cisco/xr/l2vpn/driver/XrDriverBuilder.java
cisco-xr-driver/src/test/java/org/opendaylight/unimgr/mef/nrp/cisco/xr/l2vpn/activator/L2vpnLocalConnectionActivatorTest.java
cisco-xr-driver/src/test/java/org/opendaylight/unimgr/mef/nrp/cisco/xr/l2vpn/activator/L2vpnP2pConnectionActivatorTest.java
cisco-xrmodels/src/main/java/org/opendaylight/yang/gen/v1/http/cisco/com/ns/yang/cisco/ios/xr/infra/policymgr/cfg/rev161215/IdleTimeoutBuilder.java [moved from cisco-xrmodels/src/main/java/org/opendaylight/yang/gen/v1/http/cisco/com/ns/yang/cisco/ios/xr/asr9k/policymgr/cfg/rev150518/IdleTimeoutBuilder.java with 63% similarity]
cisco-xrmodels/src/main/java/org/opendaylight/yang/gen/v1/http/cisco/com/ns/yang/cisco/ios/xr/infra/policymgr/cfg/rev161215/PrecedenceBuilder.java [moved from cisco-xrmodels/src/main/java/org/opendaylight/yang/gen/v1/http/cisco/com/ns/yang/cisco/ios/xr/asr9k/policymgr/cfg/rev150518/PrecedenceBuilder.java with 63% similarity]
cisco-xrmodels/src/main/java/org/opendaylight/yang/gen/v1/http/cisco/com/ns/yang/cisco/ios/xr/l2/eth/infra/datatypes/rev151109/VlanTagOrAnyBuilder.java
cisco-xrmodels/src/main/java/org/opendaylight/yang/gen/v1/http/cisco/com/ns/yang/cisco/ios/xr/l2/eth/infra/datatypes/rev151109/VlanTagOrCvpBuilder.java
cisco-xrmodels/src/main/java/org/opendaylight/yang/gen/v1/http/cisco/com/ns/yang/cisco/ios/xr/l2/eth/infra/datatypes/rev151109/VlanTagOrNativeBuilder.java
cisco-xrmodels/src/main/java/org/opendaylight/yang/gen/v1/http/cisco/com/ns/yang/cisco/ios/xr/l2/eth/infra/datatypes/rev151109/VlanTagOrNullBuilder.java
cisco-xrmodels/src/main/java/org/opendaylight/yang/gen/v1/http/cisco/com/ns/yang/cisco/ios/xr/snmp/agent/cfg/rev151027/SnmpDscpValueBuilder.java
cisco-xrmodels/src/main/java/org/opendaylight/yang/gen/v1/http/cisco/com/ns/yang/cisco/ios/xr/snmp/agent/cfg/rev151027/SnmpPrecedenceValue1Builder.java
cisco-xrmodels/src/main/java/org/opendaylight/yang/gen/v1/http/cisco/com/ns/yang/cisco/xr/types/rev150629/CharNumBuilder.java
cisco-xrmodels/src/main/java/org/opendaylight/yang/gen/v1/http/cisco/com/ns/yang/cisco/xr/types/rev150629/TtyEscapeCharNumBuilder.java
cisco-xrmodels/src/main/yang/Cisco-IOS-XR-asr9k-policymgr-cfg@2015-05-18.yang [deleted file]
cisco-xrmodels/src/main/yang/Cisco-IOS-XR-infra-policymgr-cfg@2016-12-15.yang [new file with mode: 0755]
docs/conf.yaml
impl/src/main/java/org/opendaylight/unimgr/mef/nrp/api/ActivationDriver.java
impl/src/main/java/org/opendaylight/unimgr/mef/nrp/common/ResourceActivator.java
impl/src/main/java/org/opendaylight/unimgr/mef/nrp/impl/DefaultValidator.java
impl/src/main/java/org/opendaylight/unimgr/mef/nrp/impl/connectivityservice/CreateConnectivityAction.java
impl/src/main/java/org/opendaylight/unimgr/mef/nrp/impl/connectivityservice/DeleteConnectivityAction.java
impl/src/main/java/org/opendaylight/unimgr/mef/nrp/impl/connectivityservice/UpdateConnectivityAction.java
impl/src/main/java/org/opendaylight/unimgr/utils/CapabilitiesService.java
impl/src/test/java/org/opendaylight/unimgr/mef/nrp/impl/connectivityservice/TapiConnectivityServiceImplTest.java
impl/src/test/java/org/opendaylight/unimgr/mef/nrp/impl/connectivityservice/TapiConnectivityServiceInplIntTest.java
impl/src/test/resources/logback-test.xml
legato-api/pom.xml
legato-api/src/main/java/org/opendaylight/unimgr/mef/legato/LegatoBwpProfileController.java [deleted file]
legato-api/src/main/java/org/opendaylight/unimgr/mef/legato/LegatoColorMappingProfileController.java [deleted file]
legato-api/src/main/java/org/opendaylight/unimgr/mef/legato/LegatoCosProfileController.java [deleted file]
legato-api/src/main/java/org/opendaylight/unimgr/mef/legato/LegatoEecProfileController.java [deleted file]
legato-api/src/main/java/org/opendaylight/unimgr/mef/legato/LegatoL2cpEecController.java [deleted file]
legato-api/src/main/java/org/opendaylight/unimgr/mef/legato/LegatoL2cpPeeringController.java [deleted file]
legato-api/src/main/java/org/opendaylight/unimgr/mef/legato/LegatoServiceController.java
legato-api/src/main/java/org/opendaylight/unimgr/mef/legato/LegatoSlsProfileController.java [deleted file]
legato-api/src/main/java/org/opendaylight/unimgr/mef/legato/dao/EVCDao.java
legato-api/src/main/java/org/opendaylight/unimgr/mef/legato/util/LegatoConstants.java
legato-api/src/main/java/org/opendaylight/unimgr/mef/legato/util/LegatoUtils.java
legato-api/src/main/resources/OSGI-INF/blueprint/legato-api-blueprint.xml
legato-api/src/test/java/org/opendaylight/unimgr/mef/legato/evc/EpLanIntegrationTest.java [new file with mode: 0644]
legato-api/src/test/java/org/opendaylight/unimgr/mef/legato/evc/EpLineIntegrationTest.java [new file with mode: 0644]
legato-api/src/test/java/org/opendaylight/unimgr/mef/legato/evc/EpTreeIntegrationTest.java [new file with mode: 0644]
legato-api/src/test/java/org/opendaylight/unimgr/mef/legato/evc/EvcDataTreeChangeListenerTest.java
legato-api/src/test/java/org/opendaylight/unimgr/mef/legato/evc/EvcIntegrationTest.java [deleted file]
legato-api/src/test/java/org/opendaylight/unimgr/mef/legato/evc/EvcUnitTest.java
legato-api/src/test/java/org/opendaylight/unimgr/mef/legato/evc/EvpLanIntegrationTest.java [new file with mode: 0644]
legato-api/src/test/java/org/opendaylight/unimgr/mef/legato/evc/EvpLineIntegrationTest.java [new file with mode: 0644]
legato-api/src/test/java/org/opendaylight/unimgr/mef/legato/evc/EvpTreeIntegrationTest.java [new file with mode: 0644]
legato-api/src/test/java/org/opendaylight/unimgr/mef/legato/global/bwp/LegatoBwpDataTreeChangeListenerTest.java [deleted file]
legato-api/src/test/java/org/opendaylight/unimgr/mef/legato/global/bwp/LegatoBwpProfileUnitTest.java [deleted file]
legato-api/src/test/java/org/opendaylight/unimgr/mef/legato/global/color/LegatoColorMappingDataTreeChangeListenerTest.java [deleted file]
legato-api/src/test/java/org/opendaylight/unimgr/mef/legato/global/color/LegatoColorMappingProfileUnitTest.java [deleted file]
legato-api/src/test/java/org/opendaylight/unimgr/mef/legato/global/cos/LegatoCosProfileDataTreeChangeListenerTest.java [deleted file]
legato-api/src/test/java/org/opendaylight/unimgr/mef/legato/global/cos/LegatoCosProfileUnitTest.java [deleted file]
legato-api/src/test/java/org/opendaylight/unimgr/mef/legato/global/eec/LegatoEecProfileDataTreeChangeListenerTest.java [deleted file]
legato-api/src/test/java/org/opendaylight/unimgr/mef/legato/global/eec/LegatoEecProfileUnitTest.java [deleted file]
legato-api/src/test/java/org/opendaylight/unimgr/mef/legato/global/l2cp/LegatoL2cpEecProfileDataTreeChangeListenerTest.java [deleted file]
legato-api/src/test/java/org/opendaylight/unimgr/mef/legato/global/l2cp/LegatoL2cpEecProfileUnitTest.java [deleted file]
legato-api/src/test/java/org/opendaylight/unimgr/mef/legato/global/l2cp/LegatoL2cpPeeringProfileDataTreeChangeListenerTest.java [deleted file]
legato-api/src/test/java/org/opendaylight/unimgr/mef/legato/global/l2cp/LegatoL2cpPeeringProfileUnitTest.java [deleted file]
legato-api/src/test/java/org/opendaylight/unimgr/mef/legato/global/sls/LegatoSlsProfileDataTreeChangeListenerTest.java [deleted file]
legato-api/src/test/java/org/opendaylight/unimgr/mef/legato/global/sls/LegatoSlsProfileUnitTest.java [deleted file]
legato-api/src/test/java/org/opendaylight/unimgr/mef/legato/utils/Constants.java
legato-api/src/test/java/org/opendaylight/unimgr/mef/legato/utils/LegatoUtilsTest.java
legato-api/src/test/resources/mockito-extensions/org.mockito.plugins.MockMaker [new file with mode: 0644]
ovs-driver/src/main/java/org/opendaylight/unimgr/mef/nrp/ovs/activator/OvsActivator.java
ovs-driver/src/main/java/org/opendaylight/unimgr/mef/nrp/ovs/driver/OvsDriver.java
ovs-driver/src/main/java/org/opendaylight/unimgr/mef/nrp/ovs/util/EtreeUtils.java [new file with mode: 0644]
ovs-driver/src/main/java/org/opendaylight/unimgr/mef/nrp/ovs/util/MatchUtils.java
ovs-driver/src/main/java/org/opendaylight/unimgr/mef/nrp/ovs/util/NullAwareDatastoreGetter.java
ovs-driver/src/main/java/org/opendaylight/unimgr/mef/nrp/ovs/util/OVSConstant.java [new file with mode: 0644]
ovs-driver/src/main/java/org/opendaylight/unimgr/mef/nrp/ovs/util/OpenFlowUtils.java
ovs-driver/src/test/java/org/opendaylight/unimgr/mef/nrp/ovs/activator/OvsActivatorTest.java
ovs-driver/src/test/resources/logback-test.xml
resources/MEF LSO with Legato.postman_collection.json
resources/create_etree_topology.py [new file with mode: 0755]
resources/create_lan_topology.py [moved from resources/create_topology_multipoint.py with 90% similarity]
resources/tag301 [new file with mode: 0644]
resources/tag305 [new file with mode: 0644]
resources/tagetree15 [new file with mode: 0644]
resources/tagetree301 [new file with mode: 0644]
resources/untag [new file with mode: 0644]
resources/untagetree [new file with mode: 0644]
template-driver/src/main/java/org/opendaylight/unimgr/mef/nrp/template/driver/TemplateDriver.java

index 392b7c930b11c691bb61f8052f7fdca78c475b12..a873c0b0f3fe079232143da37bf55ddf73a4cf70 100644 (file)
@@ -8,18 +8,19 @@
 package org.opendaylight.unimgr.mef.nrp.cisco.xr.common.helper;
 
 import org.opendaylight.unimgr.mef.nrp.cisco.xr.common.ServicePort;
-import org.opendaylight.yang.gen.v1.http.cisco.com.ns.yang.cisco.ios.xr.asr9k.policymgr.cfg.rev150518.PolicyManager;
-import org.opendaylight.yang.gen.v1.http.cisco.com.ns.yang.cisco.ios.xr.asr9k.policymgr.cfg.rev150518.PolicyManagerBuilder;
-import org.opendaylight.yang.gen.v1.http.cisco.com.ns.yang.cisco.ios.xr.asr9k.policymgr.cfg.rev150518.RateUnits;
-import org.opendaylight.yang.gen.v1.http.cisco.com.ns.yang.cisco.ios.xr.asr9k.policymgr.cfg.rev150518.ThresholdUnits;
-import org.opendaylight.yang.gen.v1.http.cisco.com.ns.yang.cisco.ios.xr.asr9k.policymgr.cfg.rev150518.policy.manager.PolicyMapsBuilder;
-import org.opendaylight.yang.gen.v1.http.cisco.com.ns.yang.cisco.ios.xr.asr9k.policymgr.cfg.rev150518.policy.manager.policy.maps.PolicyMap;
-import org.opendaylight.yang.gen.v1.http.cisco.com.ns.yang.cisco.ios.xr.asr9k.policymgr.cfg.rev150518.policy.manager.policy.maps.PolicyMapBuilder;
-import org.opendaylight.yang.gen.v1.http.cisco.com.ns.yang.cisco.ios.xr.asr9k.policymgr.cfg.rev150518.policy.map.rule.PolicyMapRule;
-import org.opendaylight.yang.gen.v1.http.cisco.com.ns.yang.cisco.ios.xr.asr9k.policymgr.cfg.rev150518.policy.map.rule.PolicyMapRuleBuilder;
-import org.opendaylight.yang.gen.v1.http.cisco.com.ns.yang.cisco.ios.xr.asr9k.policymgr.cfg.rev150518.policy.map.rule.policy.map.rule.Police;
-import org.opendaylight.yang.gen.v1.http.cisco.com.ns.yang.cisco.ios.xr.asr9k.policymgr.cfg.rev150518.policy.map.rule.policy.map.rule.PoliceBuilder;
-import org.opendaylight.yang.gen.v1.http.cisco.com.ns.yang.cisco.ios.xr.asr9k.policymgr.cfg.rev150518.policy.map.rule.policy.map.rule.police.*;
+import org.opendaylight.yang.gen.v1.http.cisco.com.ns.yang.cisco.ios.xr.infra.policymgr.cfg.rev161215.PolicyManager;
+import org.opendaylight.yang.gen.v1.http.cisco.com.ns.yang.cisco.ios.xr.infra.policymgr.cfg.rev161215.PolicyManagerBuilder;
+import org.opendaylight.yang.gen.v1.http.cisco.com.ns.yang.cisco.ios.xr.infra.policymgr.cfg.rev161215.RateUnits;
+import org.opendaylight.yang.gen.v1.http.cisco.com.ns.yang.cisco.ios.xr.infra.policymgr.cfg.rev161215.ThresholdUnits;
+import org.opendaylight.yang.gen.v1.http.cisco.com.ns.yang.cisco.ios.xr.infra.policymgr.cfg.rev161215.policy.manager.PolicyMapsBuilder;
+import org.opendaylight.yang.gen.v1.http.cisco.com.ns.yang.cisco.ios.xr.infra.policymgr.cfg.rev161215.policy.manager.policy.maps.PolicyMap;
+import org.opendaylight.yang.gen.v1.http.cisco.com.ns.yang.cisco.ios.xr.infra.policymgr.cfg.rev161215.policy.manager.policy.maps.PolicyMapBuilder;
+import org.opendaylight.yang.gen.v1.http.cisco.com.ns.yang.cisco.ios.xr.infra.policymgr.cfg.rev161215.policy.map.rule.PolicyMapRule;
+import org.opendaylight.yang.gen.v1.http.cisco.com.ns.yang.cisco.ios.xr.infra.policymgr.cfg.rev161215.policy.map.rule.PolicyMapRuleBuilder;
+import org.opendaylight.yang.gen.v1.http.cisco.com.ns.yang.cisco.ios.xr.infra.policymgr.cfg.rev161215.policy.map.rule.policy.map.rule.Police;
+import org.opendaylight.yang.gen.v1.http.cisco.com.ns.yang.cisco.ios.xr.infra.policymgr.cfg.rev161215.policy.map.rule.policy.map.rule.PoliceBuilder;
+import org.opendaylight.yang.gen.v1.http.cisco.com.ns.yang.cisco.ios.xr.infra.policymgr.cfg.rev161215.policy.map.rule.policy.map.rule.police.*;
+
 import org.opendaylight.yang.gen.v1.urn.mef.yang.mef.common.rev180321.BwpFlow;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
index 4d87b62d7dd6342e664328b6c99a3d947246169a..4a2b4c0c454ea17c0358b152edaeed0b15831fe9 100644 (file)
@@ -23,7 +23,7 @@ import org.opendaylight.unimgr.mef.nrp.cisco.xr.common.ServicePort;
 import org.opendaylight.unimgr.mef.nrp.cisco.xr.common.helper.InterfaceHelper;
 import org.opendaylight.unimgr.mef.nrp.cisco.xr.l2vpn.helper.L2vpnHelper;
 import org.opendaylight.unimgr.mef.nrp.common.ResourceActivator;
-import org.opendaylight.yang.gen.v1.http.cisco.com.ns.yang.cisco.ios.xr.asr9k.policymgr.cfg.rev150518.PolicyManager;
+import org.opendaylight.yang.gen.v1.http.cisco.com.ns.yang.cisco.ios.xr.infra.policymgr.cfg.rev161215.PolicyManager;
 import org.opendaylight.yang.gen.v1.http.cisco.com.ns.yang.cisco.ios.xr.ifmgr.cfg.rev150730.InterfaceActive;
 import org.opendaylight.yang.gen.v1.http.cisco.com.ns.yang.cisco.ios.xr.ifmgr.cfg.rev150730.InterfaceConfigurations;
 import org.opendaylight.yang.gen.v1.http.cisco.com.ns.yang.cisco.ios.xr.ifmgr.cfg.rev150730._interface.configurations.InterfaceConfiguration;
@@ -47,6 +47,7 @@ import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.
 import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.TopologyKey;
 import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node;
 import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.NodeKey;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev180307.ServiceType;
 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -75,7 +76,7 @@ public abstract class AbstractL2vpnActivator implements ResourceActivator {
     }
 
     @Override
-    public void activate(List<EndPoint> endPoints, String serviceId) throws InterruptedException, ExecutionException {
+    public void activate(List<EndPoint> endPoints, String serviceId, boolean isExclusive, ServiceType serviceType) throws InterruptedException, ExecutionException {
         String innerName = getInnerName(serviceId);
         String outerName = getOuterName(serviceId);
         ServicePort port = null;
@@ -104,7 +105,7 @@ public abstract class AbstractL2vpnActivator implements ResourceActivator {
     }
 
     @Override
-    public void deactivate(List<EndPoint> endPoints, String serviceId) throws InterruptedException, ExecutionException {
+    public void deactivate(List<EndPoint> endPoints, String serviceId, ServiceType serviceType) throws InterruptedException, ExecutionException {
         String innerName = getInnerName(serviceId);
         String outerName = getOuterName(serviceId);
         ServicePort port = toServicePort(endPoints.stream().findFirst().get(), NETCONF_TOPOLODY_NAME);
index de1014c26352f3f41bbe97eb5496ffa4166531fb..61be2aed7bec3de00af05a31b3ce65559c150c1d 100644 (file)
@@ -23,7 +23,7 @@ import org.opendaylight.unimgr.mef.nrp.cisco.xr.l2vpn.helper.AttachmentCircuitHe
 import org.opendaylight.unimgr.mef.nrp.cisco.xr.l2vpn.helper.L2vpnHelper;
 import org.opendaylight.unimgr.mef.nrp.cisco.xr.l2vpn.helper.PseudowireHelper;
 import org.opendaylight.unimgr.mef.nrp.cisco.xr.l2vpn.helper.XConnectHelper;
-import org.opendaylight.yang.gen.v1.http.cisco.com.ns.yang.cisco.ios.xr.asr9k.policymgr.cfg.rev150518.PolicyManager;
+import org.opendaylight.yang.gen.v1.http.cisco.com.ns.yang.cisco.ios.xr.infra.policymgr.cfg.rev161215.PolicyManager;
 import org.opendaylight.yang.gen.v1.http.cisco.com.ns.yang.cisco.ios.xr.ifmgr.cfg.rev150730.InterfaceConfigurations;
 import org.opendaylight.yang.gen.v1.http.cisco.com.ns.yang.cisco.ios.xr.l2vpn.cfg.rev151109.L2vpn;
 import org.opendaylight.yang.gen.v1.http.cisco.com.ns.yang.cisco.ios.xr.l2vpn.cfg.rev151109.l2vpn.database.XconnectGroups;
index 646486da828606c9d23074e7f547bf87b1a7ef19..bbb2e204b1cff68db2133abfcf93cbb29aaeea7c 100644 (file)
@@ -25,7 +25,7 @@ import org.opendaylight.unimgr.mef.nrp.cisco.xr.l2vpn.helper.AttachmentCircuitHe
 import org.opendaylight.unimgr.mef.nrp.cisco.xr.l2vpn.helper.L2vpnHelper;
 import org.opendaylight.unimgr.mef.nrp.cisco.xr.l2vpn.helper.PseudowireHelper;
 import org.opendaylight.unimgr.mef.nrp.cisco.xr.l2vpn.helper.XConnectHelper;
-import org.opendaylight.yang.gen.v1.http.cisco.com.ns.yang.cisco.ios.xr.asr9k.policymgr.cfg.rev150518.PolicyManager;
+import org.opendaylight.yang.gen.v1.http.cisco.com.ns.yang.cisco.ios.xr.infra.policymgr.cfg.rev161215.PolicyManager;
 import org.opendaylight.yang.gen.v1.http.cisco.com.ns.yang.cisco.ios.xr.ifmgr.cfg.rev150730.InterfaceConfigurations;
 import org.opendaylight.yang.gen.v1.http.cisco.com.ns.yang.cisco.ios.xr.ifmgr.cfg.rev150730._interface.configurations._interface.configuration.Mtus;
 import org.opendaylight.yang.gen.v1.http.cisco.com.ns.yang.cisco.ios.xr.l2vpn.cfg.rev151109.L2vpn;
index 9a58a1ebac4b9e74c136de831967455bf6b4cb68..92e862d7c861a604b849ac9c2bf92064f80a3743 100644 (file)
@@ -26,6 +26,7 @@ import org.opendaylight.unimgr.mef.nrp.cisco.xr.l2vpn.activator.AbstractL2vpnAct
 import org.opendaylight.unimgr.mef.nrp.cisco.xr.l2vpn.activator.L2vpnLocalConnectActivator;
 import org.opendaylight.unimgr.mef.nrp.cisco.xr.l2vpn.activator.L2vpnP2pConnectActivator;
 import org.opendaylight.yang.gen.v1.urn.mef.yang.nrp._interface.rev180321.NrpConnectivityServiceAttrs;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev180307.ServiceType;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -52,6 +53,8 @@ public class XrDriverBuilder implements ActivationDriverBuilder {
             List<Map.Entry<EndPoint,EndPoint>> bridgeActivatedPairs = null;
             List<EndPoint> endPoints;
             String serviceId;
+            ServiceType serviceType;
+            boolean isExclusive;
 
             @Override
             public void commit() {
@@ -64,9 +67,11 @@ public class XrDriverBuilder implements ActivationDriverBuilder {
             }
 
             @Override
-            public void initialize(List<EndPoint> endPoints, String serviceId, NrpConnectivityServiceAttrs context) {
+            public void initialize(List<EndPoint> endPoints, String serviceId, NrpConnectivityServiceAttrs context, boolean isExclusive, ServiceType serviceType) {
                 this.endPoints = new ArrayList<>(endPoints);
                 this.serviceId = serviceId;
+                this.isExclusive = isExclusive;
+                this.serviceType = serviceType;
 
                 localActivator = new L2vpnLocalConnectActivator(dataBroker,mountPointService);
                 p2pActivator = new L2vpnP2pConnectActivator(dataBroker,mountPointService);
@@ -131,15 +136,15 @@ public class XrDriverBuilder implements ActivationDriverBuilder {
 
             BiConsumer<List<EndPoint>,AbstractL2vpnActivator> activate = (neighbors, activator) -> {
                 try {
-                    activator.activate(neighbors, serviceId);
+                    activator.activate(neighbors, serviceId, isExclusive, serviceType);
                 } catch (InterruptedException | ExecutionException e) {
-                    LOG.error("Activation error occured: {}",e.getMessage());
+                    LOG.error("Activation error occured: {}", e.getMessage());
                 }
             };
 
             BiConsumer<List<EndPoint>,AbstractL2vpnActivator> deactivate = (neighbors, activator) -> {
                 try {
-                    activator.deactivate(neighbors, serviceId);
+                    activator.deactivate(neighbors, serviceId, serviceType);
                 } catch (InterruptedException | ExecutionException e) {
                     LOG.error("Deactivation error occured: {}",e.getMessage());
                 }
index 265a4724b7274dfba1a0ad6ddcb86a1b670a1d93..2243c8f549c8d102bb7d8173e39f6909c67f3da5 100644 (file)
@@ -31,6 +31,7 @@ import org.opendaylight.yang.gen.v1.http.cisco.com.ns.yang.cisco.ios.xr.l2vpn.cf
 import org.opendaylight.yang.gen.v1.http.cisco.com.ns.yang.cisco.ios.xr.l2vpn.cfg.rev151109.l2vpn.database.xconnect.groups.XconnectGroup;
 import org.opendaylight.yang.gen.v1.http.cisco.com.ns.yang.cisco.ios.xr.l2vpn.cfg.rev151109.l2vpn.database.xconnect.groups.xconnect.group.p2p.xconnects.P2pXconnect;
 import org.opendaylight.yang.gen.v1.http.cisco.com.ns.yang.cisco.ios.xr.l2vpn.cfg.rev151109.l2vpn.database.xconnect.groups.xconnect.group.p2p.xconnects.p2p.xconnect.attachment.circuits.AttachmentCircuit;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev180307.ServiceType;
 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -100,7 +101,7 @@ public class L2vpnLocalConnectionActivatorTest extends AbstractConcurrentDataBro
 
     private void deactivate() {
         try {
-            l2VpnLocalConnectActivator.deactivate(endPoints,serviceId);
+            l2VpnLocalConnectActivator.deactivate(endPoints,serviceId, ServiceType.POINTTOPOINTCONNECTIVITY);
         } catch (InterruptedException | ExecutionException e) {
             fail("Error during deactivation : " + e.getMessage());
         }
@@ -109,7 +110,7 @@ public class L2vpnLocalConnectionActivatorTest extends AbstractConcurrentDataBro
     private void activate() {
         LOG.debug("activate L2VPN");
         try {
-            l2VpnLocalConnectActivator.activate(endPoints,serviceId);
+            l2VpnLocalConnectActivator.activate(endPoints, serviceId, true, ServiceType.POINTTOPOINTCONNECTIVITY);
         } catch (InterruptedException | ExecutionException e) {
             fail("Error during activation : " + e.getMessage());
         }
index 353c403ace9a20b4c88ac0be0eea4bfeb53df39d..359c3011a238247c0978b6ff1b7f64f4c7e62139 100644 (file)
@@ -33,6 +33,7 @@ import org.opendaylight.yang.gen.v1.http.cisco.com.ns.yang.cisco.ios.xr.l2vpn.cf
 import org.opendaylight.yang.gen.v1.http.cisco.com.ns.yang.cisco.ios.xr.l2vpn.cfg.rev151109.l2vpn.database.xconnect.groups.xconnect.group.p2p.xconnects.p2p.xconnect.pseudowires.Pseudowire;
 import org.opendaylight.yang.gen.v1.http.cisco.com.ns.yang.cisco.ios.xr.l2vpn.cfg.rev151109.l2vpn.database.xconnect.groups.xconnect.group.p2p.xconnects.p2p.xconnect.pseudowires.pseudowire.Neighbor;
 import org.opendaylight.yang.gen.v1.http.cisco.com.ns.yang.cisco.ios.xr.l2vpn.cfg.rev151109.l2vpn.database.xconnect.groups.xconnect.group.p2p.xconnects.p2p.xconnect.pseudowires.pseudowire.pseudowire.content.MplsStaticLabels;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev180307.ServiceType;
 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
 
 import com.google.common.util.concurrent.FluentFuture;
@@ -70,7 +71,7 @@ public class L2vpnP2pConnectionActivatorTest extends AbstractConcurrentDataBroke
     public void testActivateAndDeactivate() {
         //when
         try {
-            l2VpnP2PConnectActivator.activate(endPoints,serviceId);
+            l2VpnP2PConnectActivator.activate(endPoints, serviceId, true, ServiceType.POINTTOPOINTCONNECTIVITY);
         } catch (InterruptedException | ExecutionException e) {
             fail("Error during activation : " + e.getMessage());
         }
@@ -101,7 +102,7 @@ public class L2vpnP2pConnectionActivatorTest extends AbstractConcurrentDataBroke
     private void deactivate() {
         //when
         try {
-            l2VpnP2PConnectActivator.deactivate(endPoints,serviceId);
+            l2VpnP2PConnectActivator.deactivate(endPoints,serviceId, ServiceType.POINTTOPOINTCONNECTIVITY);
         } catch (InterruptedException | ExecutionException e) {
             fail("Error during deactivation : " + e.getMessage());
         }
@@ -1,5 +1,6 @@
-package org.opendaylight.yang.gen.v1.http.cisco.com.ns.yang.cisco.ios.xr.asr9k.policymgr.cfg.rev150518;
-
+package org.opendaylight.yang.gen.v1.http.cisco.com.ns.yang.cisco.ios.xr.infra.policymgr.cfg.rev161215;
+import java.lang.String;
+import java.lang.UnsupportedOperationException;
 
 /**
  * The purpose of generated class in src/main/java for Union types is to create new instances of unions from a string representation.
@@ -11,9 +12,12 @@ package org.opendaylight.yang.gen.v1.http.cisco.com.ns.yang.cisco.ios.xr.asr9k.p
  *
  */
 public class IdleTimeoutBuilder {
+    private IdleTimeoutBuilder() {
+        //Exists only to defeat instantiation.
+    }
 
-    public static IdleTimeout getDefaultInstance(java.lang.String defaultValue) {
-        throw new java.lang.UnsupportedOperationException("Not yet implemented");
+    public static IdleTimeout getDefaultInstance(String defaultValue) {
+        throw new UnsupportedOperationException("Not yet implemented");
     }
 
 }
@@ -1,5 +1,6 @@
-package org.opendaylight.yang.gen.v1.http.cisco.com.ns.yang.cisco.ios.xr.asr9k.policymgr.cfg.rev150518;
-
+package org.opendaylight.yang.gen.v1.http.cisco.com.ns.yang.cisco.ios.xr.infra.policymgr.cfg.rev161215;
+import java.lang.String;
+import java.lang.UnsupportedOperationException;
 
 /**
  * The purpose of generated class in src/main/java for Union types is to create new instances of unions from a string representation.
@@ -11,9 +12,12 @@ package org.opendaylight.yang.gen.v1.http.cisco.com.ns.yang.cisco.ios.xr.asr9k.p
  *
  */
 public class PrecedenceBuilder {
+    private PrecedenceBuilder() {
+        //Exists only to defeat instantiation.
+    }
 
-    public static Precedence getDefaultInstance(java.lang.String defaultValue) {
-        throw new java.lang.UnsupportedOperationException("Not yet implemented");
+    public static Precedence getDefaultInstance(String defaultValue) {
+        throw new UnsupportedOperationException("Not yet implemented");
     }
 
 }
index 83d4a4f48707e42a22fa4e4610e4455884a42f09..cbb9fd13799deb2751655c0c948f33cca91436e9 100644 (file)
@@ -1,5 +1,6 @@
 package org.opendaylight.yang.gen.v1.http.cisco.com.ns.yang.cisco.ios.xr.l2.eth.infra.datatypes.rev151109;
-
+import java.lang.String;
+import java.lang.UnsupportedOperationException;
 
 /**
  * The purpose of generated class in src/main/java for Union types is to create new instances of unions from a string representation.
@@ -11,9 +12,12 @@ package org.opendaylight.yang.gen.v1.http.cisco.com.ns.yang.cisco.ios.xr.l2.eth.
  *
  */
 public class VlanTagOrAnyBuilder {
+    private VlanTagOrAnyBuilder() {
+        //Exists only to defeat instantiation.
+    }
 
-    public static VlanTagOrAny getDefaultInstance(java.lang.String defaultValue) {
-        throw new java.lang.UnsupportedOperationException("Not yet implemented");
+    public static VlanTagOrAny getDefaultInstance(String defaultValue) {
+        throw new UnsupportedOperationException("Not yet implemented");
     }
 
 }
index 5aa9521e7a6f316aaf80080ac5013fece9dad0d4..498b557f579169a3ba3ac6e04ea956bcc0e19ec6 100644 (file)
@@ -1,5 +1,6 @@
 package org.opendaylight.yang.gen.v1.http.cisco.com.ns.yang.cisco.ios.xr.l2.eth.infra.datatypes.rev151109;
-
+import java.lang.String;
+import java.lang.UnsupportedOperationException;
 
 /**
  * The purpose of generated class in src/main/java for Union types is to create new instances of unions from a string representation.
@@ -11,9 +12,12 @@ package org.opendaylight.yang.gen.v1.http.cisco.com.ns.yang.cisco.ios.xr.l2.eth.
  *
  */
 public class VlanTagOrCvpBuilder {
+    private VlanTagOrCvpBuilder() {
+        //Exists only to defeat instantiation.
+    }
 
-    public static VlanTagOrCvp getDefaultInstance(java.lang.String defaultValue) {
-        throw new java.lang.UnsupportedOperationException("Not yet implemented");
+    public static VlanTagOrCvp getDefaultInstance(String defaultValue) {
+        throw new UnsupportedOperationException("Not yet implemented");
     }
 
 }
index 38dd7d16380f41a4f0006a99d8c57fb798442d82..363a5e5a108d0a3ba3899ebec8e03eecec6a73a8 100644 (file)
@@ -1,5 +1,6 @@
 package org.opendaylight.yang.gen.v1.http.cisco.com.ns.yang.cisco.ios.xr.l2.eth.infra.datatypes.rev151109;
-
+import java.lang.String;
+import java.lang.UnsupportedOperationException;
 
 /**
  * The purpose of generated class in src/main/java for Union types is to create new instances of unions from a string representation.
@@ -11,9 +12,12 @@ package org.opendaylight.yang.gen.v1.http.cisco.com.ns.yang.cisco.ios.xr.l2.eth.
  *
  */
 public class VlanTagOrNativeBuilder {
+    private VlanTagOrNativeBuilder() {
+        //Exists only to defeat instantiation.
+    }
 
-    public static VlanTagOrNative getDefaultInstance(java.lang.String defaultValue) {
-        throw new java.lang.UnsupportedOperationException("Not yet implemented");
+    public static VlanTagOrNative getDefaultInstance(String defaultValue) {
+        throw new UnsupportedOperationException("Not yet implemented");
     }
 
 }
index b2253ce15a2436a3e4796aeaebcc7fb162da3d02..56962a1a75a745418b9f680c7c065bc46bfd71fe 100644 (file)
@@ -1,5 +1,6 @@
 package org.opendaylight.yang.gen.v1.http.cisco.com.ns.yang.cisco.ios.xr.l2.eth.infra.datatypes.rev151109;
-
+import java.lang.String;
+import java.lang.UnsupportedOperationException;
 
 /**
  * The purpose of generated class in src/main/java for Union types is to create new instances of unions from a string representation.
@@ -11,9 +12,12 @@ package org.opendaylight.yang.gen.v1.http.cisco.com.ns.yang.cisco.ios.xr.l2.eth.
  *
  */
 public class VlanTagOrNullBuilder {
+    private VlanTagOrNullBuilder() {
+        //Exists only to defeat instantiation.
+    }
 
-    public static VlanTagOrNull getDefaultInstance(java.lang.String defaultValue) {
-        throw new java.lang.UnsupportedOperationException("Not yet implemented");
+    public static VlanTagOrNull getDefaultInstance(String defaultValue) {
+        throw new UnsupportedOperationException("Not yet implemented");
     }
 
 }
index 3225be12a0ca7b0573a9bd43e5fa634e89297c10..4c17435ff6cd8ec3df8e9b257814ea8b3f8574e0 100644 (file)
@@ -1,5 +1,6 @@
 package org.opendaylight.yang.gen.v1.http.cisco.com.ns.yang.cisco.ios.xr.snmp.agent.cfg.rev151027;
-
+import java.lang.String;
+import java.lang.UnsupportedOperationException;
 
 /**
  * The purpose of generated class in src/main/java for Union types is to create new instances of unions from a string representation.
@@ -11,9 +12,12 @@ package org.opendaylight.yang.gen.v1.http.cisco.com.ns.yang.cisco.ios.xr.snmp.ag
  *
  */
 public class SnmpDscpValueBuilder {
+    private SnmpDscpValueBuilder() {
+        //Exists only to defeat instantiation.
+    }
 
-    public static SnmpDscpValue getDefaultInstance(java.lang.String defaultValue) {
-        throw new java.lang.UnsupportedOperationException("Not yet implemented");
+    public static SnmpDscpValue getDefaultInstance(String defaultValue) {
+        throw new UnsupportedOperationException("Not yet implemented");
     }
 
 }
index a45e2609dc05f01a53a6083710d30d27adbce00e..382ebe44232fb7de2ddd1808273ce85b11bf3b13 100644 (file)
@@ -1,5 +1,6 @@
 package org.opendaylight.yang.gen.v1.http.cisco.com.ns.yang.cisco.ios.xr.snmp.agent.cfg.rev151027;
-
+import java.lang.String;
+import java.lang.UnsupportedOperationException;
 
 /**
  * The purpose of generated class in src/main/java for Union types is to create new instances of unions from a string representation.
@@ -11,9 +12,12 @@ package org.opendaylight.yang.gen.v1.http.cisco.com.ns.yang.cisco.ios.xr.snmp.ag
  *
  */
 public class SnmpPrecedenceValue1Builder {
+    private SnmpPrecedenceValue1Builder() {
+        //Exists only to defeat instantiation.
+    }
 
-    public static SnmpPrecedenceValue1 getDefaultInstance(java.lang.String defaultValue) {
-        throw new java.lang.UnsupportedOperationException("Not yet implemented");
+    public static SnmpPrecedenceValue1 getDefaultInstance(String defaultValue) {
+        throw new UnsupportedOperationException("Not yet implemented");
     }
 
 }
index e0ce56d188633608c75e5dcc4e35f44ed22a7245..4ac5158d3e8be5c9e58318b9fb174ec5a033ef23 100644 (file)
@@ -1,5 +1,6 @@
 package org.opendaylight.yang.gen.v1.http.cisco.com.ns.yang.cisco.xr.types.rev150629;
-
+import java.lang.String;
+import java.lang.UnsupportedOperationException;
 
 /**
  * The purpose of generated class in src/main/java for Union types is to create new instances of unions from a string representation.
@@ -11,9 +12,12 @@ package org.opendaylight.yang.gen.v1.http.cisco.com.ns.yang.cisco.xr.types.rev15
  *
  */
 public class CharNumBuilder {
+    private CharNumBuilder() {
+        //Exists only to defeat instantiation.
+    }
 
-    public static CharNum getDefaultInstance(java.lang.String defaultValue) {
-        throw new java.lang.UnsupportedOperationException("Not yet implemented");
+    public static CharNum getDefaultInstance(String defaultValue) {
+        throw new UnsupportedOperationException("Not yet implemented");
     }
 
 }
index f5a5e9fe2295e4d362b948e4edda648549271fb1..cf3a235122113328a18f0906e57388a90d6fb066 100644 (file)
@@ -1,5 +1,6 @@
 package org.opendaylight.yang.gen.v1.http.cisco.com.ns.yang.cisco.xr.types.rev150629;
-
+import java.lang.String;
+import java.lang.UnsupportedOperationException;
 
 /**
  * The purpose of generated class in src/main/java for Union types is to create new instances of unions from a string representation.
@@ -11,9 +12,12 @@ package org.opendaylight.yang.gen.v1.http.cisco.com.ns.yang.cisco.xr.types.rev15
  *
  */
 public class TtyEscapeCharNumBuilder {
+    private TtyEscapeCharNumBuilder() {
+        //Exists only to defeat instantiation.
+    }
 
-    public static TtyEscapeCharNum getDefaultInstance(java.lang.String defaultValue) {
-        throw new java.lang.UnsupportedOperationException("Not yet implemented");
+    public static TtyEscapeCharNum getDefaultInstance(String defaultValue) {
+        throw new UnsupportedOperationException("Not yet implemented");
     }
 
 }
diff --git a/cisco-xrmodels/src/main/yang/Cisco-IOS-XR-asr9k-policymgr-cfg@2015-05-18.yang b/cisco-xrmodels/src/main/yang/Cisco-IOS-XR-asr9k-policymgr-cfg@2015-05-18.yang
deleted file mode 100644 (file)
index 3401aec..0000000
+++ /dev/null
@@ -1,1633 +0,0 @@
-module Cisco-IOS-XR-asr9k-policymgr-cfg {
-
-  namespace 
-    "http://cisco.com/ns/yang/Cisco-IOS-XR-asr9k-policymgr-cfg";
-  
-  prefix "asr9k-policymgr-cfg";
-    
-  import ietf-inet-types { 
-    prefix inet;
-  }
-    
-  import ietf-yang-types { 
-    prefix yang;
-  }
-    
-  organization "Cisco Systems, Inc.";
-
-  contact
-    "Cisco Systems, Inc.
-     Customer Service
-
-     Postal: 170 West Tasman Drive
-     San Jose, CA 95134
-
-     Tel: +1 800 553-NETS
-
-     E-mail: cs-yang@cisco.com";
-
-  description 
-    "This module contains a collection of YANG definitions
-     for Cisco IOS-XR ASR9k policy manager configuration.
-
-     Copyright (c) 2013, 2015 by Cisco Systems, Inc.
-     All rights reserved.";
-
-  revision "2015-05-18" {
-    description
-      "IOS XR 5.3.2 revision.";
-  }
-
-  revision "2013-07-22" {
-    description
-      "Initial revision.";
-  }
-
-  typedef Class-map-type {
-    type enumeration {
-      enum qos {
-        value 1;
-        description "QoS Classmap.";
-      }
-      enum traffic {
-        value 3;
-        description "TRAFFIC Classmap.";
-      }
-      enum control {
-        value 4;
-        description "Control Subscriber Classmap.";
-      }
-    }
-    description "Policy manager class-map type.";
-  }
-
-  typedef Alarm-severity {
-    type string {
-      pattern "(informational)|(notification)|(warning)|(error)|"+
-              "(critical)|(alert)|(emergency)";
-    }
-    description "Alaram severity types.";
-  }
-
-  typedef Policy-map-type {
-    type enumeration {
-      enum qos {
-        value 1;
-        description "QoS Policymap";
-      }
-      enum pbr {
-        value 2;
-        description "PBR Policymap";
-      }
-      enum traffic {
-        value 3;
-        description "TRAFFIC Policymap";
-      }
-      enum subscriber-control {
-        value 4;
-        description "SUBSCRIBER-CONTROL Policymap";
-      }
-      enum redirect {
-        value 6;
-        description "REDIRECT Policy map";
-      }
-      enum flow-monitor {
-        value 7;
-        description "FLOWMONITOR Policy map";
-      }
-    }
-    description "Policy manager policy-map type.";
-  }
-
-  typedef Service-policy-type {
-    type string {
-      pattern "(PBR)|(QOS)|(REDIRECT)|(TRAFFIC)
-               |(pbr)|(qos)|(redirect)|(traffic)";
-    }
-    description "Policy manager service-policy type.";
-  }
-
-  typedef Pmap-class-map-type {
-    type enumeration {
-      enum qos {
-        value 1;
-        description "QoS Classmap.";
-      }
-      enum traffic {
-        value 2;
-        description "TRAFFIC Classmap.";
-      }
-      enum subscriber-control {
-        value 3;
-        description "Subscriber Control Classmap.";
-      }
-    }
-    description "Policy manager class-map type.";
-  }
-
-  typedef Bandwidth-units {
-    type string {
-      pattern "(bps)|(kbps)|(mbps)|(gbps)|(percent)|(per-million)|"+
-              "(per-thousand)";
-    }
-    description "Supported units for bandwidth.
-                 bps          - units in Bits/Sec
-                 kbps         - units in KiloBits/Sec
-                 mbps         - units in MegaBits/Sec
-                 gbps         - units in GigaBits/Sec
-                 percent      - units in Percentage
-                 per-million  - parts per-million bandwidth value
-                 per-thousand - Parts per-thousand bandwidth value";
-  }
-
-  typedef Bandwidth-remaining-units {
-    type string {
-      pattern "(percent)|(ratio)";
-    }
-    description "Supported units for bandwidth remaining.
-                 percent      - units in Percentage
-                 ratio        - units in Ratio";
-  }
-
-  typedef Rate-units {
-    type string {
-      pattern "(bps)|(kbps)|(mbps)|(gbps)|(pps)|(percent)";
-    }
-    description "Supported units for police rate or peak-rate.
-                 bps     - units in Bits/Sec
-                 kbps    - units in KiloBits/Sec
-                 mbps    - units in MegaBits/Sec
-                 gbps    - units in GigaBits/Sec
-                 pps     - units in Packets/Sec
-                 percent - units in Percentage";
-  }
-
-  typedef Cac-rate-units {
-    type string {
-      pattern "(bps)|(kbps)|(mbps)|(gbps)|(cellsps)";
-    }
-    description "Supported units for CAC rate or flow-rate.
-                 bps     - units in Bits/Sec
-                 kbps    - units in KiloBits/Sec
-                 mbps    - units in MegaBits/Sec
-                 gbps    - units in GigaBits/Sec
-                 cellsps - units in Cells/Sec";
-  }
-
-  typedef Queue-units {
-    type string {
-      pattern "(bytes)|(kbytes)|(mbytes)|(gbytes)|(us)|(ms)|"+
-              "(packets)|(cells)";
-    }
-    description "Supported units for queue.
-                 bytes   - units in Bytes
-                 kbytes  - units in KiloBytes
-                 mbytes  - units in MegaBytes
-                 gbytes  - units in Gigabytes
-                 us      - units in Microseconds
-                 ms      - units in Milliseconds
-                 packets - units in Packets
-                 cells   - units in Cells";
-  }
-  
-  typedef Threshold-units {
-    type string {
-      pattern "(bytes)|(kbytes)|(mbytes)|(gbytes)|(us)|(ms)|"+
-              "(packets)|(cells)";
-    }
-    description "Supported units for RED threshold.
-                 bytes   - units in Bytes
-                 kbytes  - units in KiloBytes
-                 mbytes  - units in MegaBytes
-                 gbytes  - units in GigaBytes
-                 us      - units in Microseconds
-                 ms      - units in Milliseconds
-                 packets - units in Packets
-                 cells   - units in Cells";
-  }
-
-  typedef Float-str {
-    type string {
-      pattern "[0-9]+(\.[0-9]+)?";
-    }
-    description "Floating point number string representation.";
-  }
-  
-  typedef Dscp {
-    type string {
-      pattern "([0-9]|[1-5][0-9]|6[0-3])|"+
-              "(af11)|(af12)|(af13)|(af21)|(af22)|(af23)|(af31)|"+
-              "(af32)|(af33)|(af41)|(af42)|(af43)|(ef)|(default)|"+
-              "(cs1)|(cs2)|(cs3)|(cs4)|(cs5)|(cs6)|(cs7)";
-    }
-    description "DSCP value string representation.
-                 Should be single value 0..63 or predefined string.";
-  }
-
-  typedef Dscp-range {
-    type string {
-      pattern "([0-9]|[1-5][0-9]|6[0-3])|"+
-              "(([0-9]|[1-5][0-9]|6[0-3])-"+
-              "([0-9]|[1-5][0-9]|6[0-3]))|"+
-              "(af11)|(af12)|(af13)|(af21)|(af22)|(af23)|(af31)|"+
-              "(af32)|(af33)|(af41)|(af42)|(af43)|(ef)|(default)|"+
-              "(cs1)|(cs2)|(cs3)|(cs4)|(cs5)|(cs6)|(cs7)";
-    }
-    description "DSCP value or range string representation.
-                 Should be single value 0..63 or predefined string 
-                 or range <min>-<max>.";
-  }
-  
-  typedef Num-range {
-    type string {
-      pattern "(\d+)|(\d+\-\d+)";
-    }
-    description "Numeric value or range string representation.
-                 Should be single value or range <min>-<max>.";
-  }
-  
-  typedef Protocol {
-    type string {
-      pattern 
-        "([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])|"+
-        "(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\-"+
-        "([1-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5]))|"+
-        "((ahp)|(dhcpv4)|(dhcpv6)|(eigrp)|(esp)|(gre)|(icmp)|"+
-        "(igmp)|(igrp)|(ipinip)|(ipv4)|(ipv6)|(ipv6icmp)|(mpls)|"+
-        "(nos)|(ospf)|(pcp)|(pim)|(ppp)|(sctp)|(tcp)|(udp))";
-    }
-    description "Numeric value or range or string representation.
-                 Should be single value or range 0..255.";
-  }
-  
-  typedef Ethertype {
-    type string {
-      pattern 
-        "((153[6-9]|15[4-9][0-9]|1[6-9][0-9][0-9]|[2-9][0-9][0-9][0-9])|"+
-        "([1-5][0-9][0-9][0-9][0-9]|6[0-4][0-9][0-9][0-9])|"+
-        "(65[0-4][0-9][0-9]|655[0-2][0-9]|6553[0-5]))|"+
-        "((arp)|(ipv4)|(ipv6))";
-    }
-    description "Numeric value or string representation.
-                 Should be single value 1536..65535 or predefined string.";
-  }
-
-  typedef Precedence {
-    type union {
-      type uint8 {
-        range "0..7";
-      }
-      type string {
-        pattern "(critical)|(flash)|(flash-override)|(immediate)|"+
-                "(internet)|(network)|(priority)|(routine)";
-      }
-    }
-    description "Precedence value.
-                 critical        Critical precedence (5)
-                 flash           Flash precedence (3)
-                 flash-override  Flash override precedence (4)
-                 immediate       Immediate precedence (2)
-                 internet        Internetwork control precedence (6)
-                 network         Network control precedence (7)
-                 priority        Priority precedence (1)
-                 routine         Routine precedence (0)";
-  }
-  
-  typedef Cos {
-    type uint8 {
-      range "0..7";
-    }
-    description "Cos value.";
-  }
-
-  typedef Idle-timeout-number {
-    type uint16 {
-      range "10..2550";
-    }
-    units "seconds";
-    description "String that idle-timeout can take.";
-  }
-  
-  typedef Idle-timeout-string {
-    type string {
-      pattern "(None)|(none)";
-    }
-    description "This flow does not expire.";
-  }
-  
-  typedef Idle-timeout {
-    type union {
-      type Idle-timeout-number;
-      type Idle-timeout-string;
-    }
-    description "Idle timeout.";
-  }
-  
-  typedef Event-type {
-    type enumeration {
-      enum account-logoff {
-        description "Account logoff event.";
-      }
-      enum account-logon {
-        description "Account logon event.";
-      }
-      enum authentication-failure {
-        description "Authentication failure event.";
-      }
-      enum authentication-no-response {
-        description "Authentication no response event.";
-      }
-      enum authorization-failure {
-        description "Authorization failure event.";
-      }
-      enum authorization-no-response {
-        description "Authorization no response event.";
-      }
-      enum credit-exhausted {
-        description "Credit exhaustion event.";
-      }
-      enum exception {
-        description "Exception event.";
-      }
-      enum idle-timeout {
-        description "Idle timeout event.";
-      }
-      enum quota-depleted {
-        description "Quota depletion event.";
-      }
-      enum service-start {
-        description "Service start event.";
-      }
-      enum service-stop {
-        description "Service stop event.";
-      }
-      enum session-activate {
-        description "Session activate event.";
-      }
-      enum session-start {
-        description "Session start event.";
-      }
-      enum session-stop {
-        description "Session stop event.";
-      }
-      enum timer-expiry {
-        description "Timer expiry event.";
-      }
-    }
-    description "Event type.";
-  }
-  
-  typedef Execution-strategy {
-    type enumeration {
-      enum do-all {
-        description "Do all actions.";
-      }
-      enum do-until-failure {
-        description "Do all actions until failure.";
-      }
-      enum do-until-success {
-        description "Do all actions until success.";
-      }
-    }
-    description "Executuion strategy.";
-  }
-  
-  typedef Authorize-identifier {
-    type enumeration {
-      enum circuit-id {
-        description "Authorize circuit ID.";
-      }
-      enum remote-id {
-        description "Authorize remote ID.";
-      }
-      enum source-address-ipv4 {
-        description "Authorize source IPv4 address.";
-      }
-      enum source-address-ipv6 {
-        description "Authorize source IPv6 address.";
-      }
-      enum source-address-mac {
-        description "Authorize source MAC address.";
-      }
-      enum username {
-        description "Authorize username.";
-      }
-    }
-    description "Authorize identifier.";
-  }
-  
-  grouping MATCH {
-    description "Supported 'match' or 'match-not' actions.";
-    leaf-list ipv4-dscp {
-      type Dscp-range;
-      max-elements 8;
-      description "Match IPv4 DSCP.";
-    }
-    leaf-list ipv6-dscp {
-      type Dscp-range;
-      max-elements 8;
-      description "Match IPv6 DSCP.";
-    }
-    leaf-list dscp {
-      type Dscp-range;
-      max-elements 8;
-      description "Match DSCP.";
-    }
-    leaf-list ipv4-precedence {
-      type Precedence;
-      max-elements 8;
-      description "Match IPv4 precedence.";
-    }
-    leaf-list ipv6-precedence {
-      type Precedence;
-      max-elements 8;
-      description "Match IPv6 precedence.";
-    }
-    leaf-list precedence {
-      type Precedence;
-      max-elements 8;
-      description "Match precedence.";
-    }
-    leaf-list qos-group {
-      type Num-range;
-      max-elements 8;
-      description "Match QoS group.
-                   Should be value 0..512 or range.";
-    }
-    leaf-list cos {
-      type Cos;
-      max-elements 8;
-      description "Match CoS.";
-    }
-    leaf-list inner-cos {
-      type Cos;
-      max-elements 8;
-      description "Match inner CoS.";
-    }
-    leaf-list protocol {
-      type Protocol;
-      max-elements 7;
-      description "Match protocol.";
-    }
-    leaf ipv4-acl {
-      type string {
-        length "1..64";
-      }
-      description "Match IPv4 ACL.";
-    }
-    leaf ipv6-acl {
-      type string {
-        length "1..64";
-      }
-      description "Match IPv6 ACL.";
-    }
-    leaf-list mpls-experimental-topmost {
-      type Cos;
-      max-elements 8;
-      description "Match MPLS experimental topmost label.";
-    }
-    leaf-list mpls-experimental-imposition {
-      type Cos;
-      max-elements 8;
-      description "Match MPLS experimental imposition label.";
-    }
-    leaf-list discard-class {
-      type Cos;
-      max-elements 8;
-      description "Match discard class.";
-    }
-    leaf-list ipv4-packet-length {
-      type Num-range;
-      max-elements 8;
-      description "Match IPv4 packet length.
-                   Should be value 0..65535 or range.";
-    }
-    leaf-list ipv6-packet-length {
-      type Num-range;
-      max-elements 8;
-      description "Match IPv6 packet length. 
-                   Should be value 0..65535 or range.";
-    }
-    leaf-list packet-length {
-      type Num-range;
-      max-elements 8;
-      description "Match packet length. 
-                   Should be value 0..65535 or range.";
-    }
-    leaf mpls-disposition-ipv4-access-list {
-      type string {
-        length "1..32";
-      }
-      description "Match MPLS Label Disposition IPv4 access list.";
-    }
-    leaf mpls-disposition-ipv6-access-list {
-      type string {
-        length "1..32";
-      }
-      description "Match MPLS Label Disposition IPv6 access list.";
-    }
-    leaf-list vlan {
-      type Num-range;
-      max-elements 8;
-      description "Match VLAN ID.";
-    }
-    leaf-list inner-vlan {
-      type Num-range;
-      max-elements 8;
-      description "Match inner VLAN ID.";
-    }
-    leaf-list flow-tag {
-      type Num-range;
-      max-elements 8;
-      description "Match flow-tag. Should be value 1..63 or range.";
-    }
-    leaf-list ethertype {
-      type Ethertype;
-      max-elements 8;
-      description "Match Ethertype.";
-    }
-    list destination-address-ipv4 {
-      key "address netmask";
-      max-elements 8;
-      description "Match destination IPv4 address.";
-      leaf address {
-        type inet:ipv4-address-no-zone;
-        description "IPv4 address.";
-      }
-      leaf netmask {
-        type inet:ipv4-address-no-zone;
-        description "IPv4 netmask.";
-      }
-    }
-    list destination-address-ipv6 {
-      key "address prefix-length";
-      max-elements 8;
-      description "Match destination IPv6 address.";
-      leaf address {
-        type inet:ipv6-address-no-zone;
-        description "IPv6 address.";
-      }
-      leaf prefix-length {
-        type uint8 {
-          range "0..128";
-        }
-        description "IPv6 prefix length.";
-      }
-    }
-    leaf-list destination-port {
-      type Num-range;
-      max-elements 8;
-      description "Match destination port. 
-                   Should be value 0..65535 or range.";
-    }
-    leaf-list fragment-type {
-      type string {
-        pattern "(first-fragment)|(is-fragment)|(last-fragment)";
-      }
-      max-elements 3;
-      description "Match fragment type for a packet.";
-    }
-    leaf-list frame-relay-dlci {
-      type Num-range;
-      max-elements 8;
-      description "Match frame-relay DLCI value. 
-                   Should be value 16..1007 or range.";
-    }
-    leaf fr-de {
-        type uint8 {
-          range "0..1";
-        }
-        description "Set FrameRelay DE bit.";
-    }
-    leaf-list icmpv4-code {
-      type Num-range;
-      max-elements 8;
-      description "Match IPv4 ICMP code. 
-                   Should be value 0..255 or range.";
-    }
-    leaf-list icmpv4-type {
-      type Num-range;
-      max-elements 8;
-      description "Match IPv4 ICMP type. 
-                   Should be value 0..255 or range.";
-    }
-    leaf-list icmpv6-code {
-      type Num-range;
-      max-elements 8;
-      description "Match IPv6 ICMP code. 
-                   Should be value 0..255 or range.";
-    }
-    leaf-list icmpv6-type {
-      type Num-range;
-      max-elements 8;
-      description "Match IPv6 ICMP type. 
-                   Should be value 0..255 or range.";
-    }
-    list source-address-ipv4 {
-      key "address netmask";
-      max-elements 8;
-      description "Match source IPv4 address.";
-      leaf address {
-        type inet:ipv4-address-no-zone;
-        description "IPv4 address.";
-      }
-      leaf netmask {
-        type inet:ipv4-address-no-zone;
-        description "IPv4 netmask.";
-      }
-    }
-    list source-address-ipv6 {
-      key "address prefix-length";
-      max-elements 8;
-      description "Match source IPv6 address.";
-      leaf address {
-        type inet:ipv6-address-no-zone;
-        description "IPv6 address.";
-      }
-      leaf prefix-length {
-        type uint8 {
-          range "0..128";
-        }
-        description "IPv6 prefix length.";
-      }
-    }
-    leaf-list source-port {
-      type Num-range;
-      max-elements 8;
-      description "Match source port. 
-                   Should be value 0..65535 or range.";
-    }
-    leaf tcp-flag {
-      type uint16 {
-        range "1..4095";
-      }
-      description "Match TCP flag.";
-    }
-    leaf authen-status {
-      type string {
-        pattern "(authenticated)|(unauthenticated)";
-      }
-      description "Match authentication status.";
-    }
-    list domain-name {
-      key "name format";
-      max-elements 8;
-      description "Match domain name.";
-      leaf name {
-        type string {
-          length "1..32";
-        }
-        description "Domain name or regular expression.";
-      }
-      leaf format {
-        type string {
-          length "1..32";
-        }
-        description "Domain-format name.";
-      }
-    }
-    leaf-list service-name {
-      type string {
-        length "1..32";
-      }
-      max-elements 8;
-      description "Match servicve name.";
-    }
-    leaf-list service-name-regex {
-      type string {
-        length "1..32";
-      }
-      max-elements 8;
-      description "Match servicve name regular expression.";
-    }
-    leaf-list timer {
-      type string {
-        length "1..32";
-      }
-      max-elements 8;
-      description "Match timer.";
-    }
-    leaf-list timer-regex {
-      type string {
-        length "1..32";
-      }
-      max-elements 8;
-      description "Match timer regular expression.";
-    }
-    leaf-list user-name {
-      type string {
-        length "1..32";
-      }
-      max-elements 8;
-      description "Match user name.";
-    }
-    leaf-list user-name-regex {
-      type string {
-        length "1..32";
-      }
-      max-elements 8;
-      description "Match user name regular expression.";
-    }
-  }
-  
-  grouping MATCH-MATCHNOT {
-    description "match or match-not containers.";
-    container match {
-      description "Match rules.";
-      uses MATCH;
-      leaf source-mac {
-        type yang:mac-address;
-        description "Match source MAC address.";
-      }
-      leaf destination-mac {
-        type yang:mac-address;
-        description "Match destination MAC address.";
-      }
-      leaf atm-clp {
-        type uint8 {
-          range "0..1";
-        }
-       description "Match ATM CLP bit.";
-      }
-      leaf atm-oam {
-        type empty;
-        description "Match ATM OAM.";
-      }
-      leaf cac-admit {
-        type empty;
-        description "Match CAC admitted.";
-      }
-      leaf cac-unadmit {
-        type empty;
-        description "Match CAC unadmitted.";
-      }
-      container flow {
-        description "Match flow.";
-        leaf-list flow-key {
-          type string {
-            pattern "(SourceIP)|(DestinationIP)|(5Tuple)";
-          }
-          max-elements 2;
-          description "Configure the flow-key parameters.";
-        }
-        container flow-cache {
-          description "Configure the flow-cache parameters";
-          leaf idle-timeout {
-            type Idle-timeout;
-            description "Maximum time of inactivity for a flow.";
-          }
-        }
-      }
-    }
-    container match-not {
-      description "Match not rules.";
-      uses MATCH;
-    }  
-  }
-  grouping CLASS-MAP-RULE {
-    description "Class-map rule";
-    leaf class-map-mode-match-any {
-      when "count(../class-map-mode-match-all) = 0" {
-          description "Class MUST have only one mode.";
-      }
-      type empty;
-      description "Match all match criteria";
-    }
-    leaf class-map-mode-match-all {
-      when "count(../class-map-mode-match-any) = 0" {
-          description "Class MUST have only one mode.";
-      }
-      type empty;
-      description "Match any match criteria.";
-    }
-    uses MATCH-MATCHNOT;
-    leaf description {
-      type string;
-      description "Description for this policy-map.";
-    }
-  }
-  
-  grouping POLICY-MARK {
-    description "Policy packet marking actions.";
-    leaf dscp {
-      type Dscp;
-      description 
-        "Marks a packet by setting the DSCP in the ToS byte.";
-    }
-    leaf qos-group {
-      type uint16 {
-        range "0..512";
-      }
-      description
-        "Sets the QoS group identifiers on IPv4 or MPLS packets.
-         The set qos-group is supported only on an ingress policy.";
-    }
-    leaf discard-class {
-      type uint8 {
-        range "0..7";
-      }
-      description
-        "Sets the discard class on IPv4 or MPLS packets.
-         The discard-class can be used only in service policies 
-         that are attached in the ingress policy.";
-    }
-    leaf forward-class {
-      type uint8 {
-        range "0..7";
-      }
-      description 
-        "Sets the discard class.";
-    }
-    leaf df {
-      type uint8 {
-        range "0..1";
-      }
-      description "Set DF bit.";
-    }
-    leaf cos {
-      type uint8 {
-        range "0..7";
-      }
-      description 
-        "Sets the specific IEEE 802.1Q Layer 2 CoS value of an
-         outgoing packet.
-         This command should be used by a router if a user wants
-         to mark a packet that is being sent to a switch. 
-         Switches can leverage Layer 2 header information, 
-         including a CoS value marking. Packets entering an 
-         interface cannot be set with a CoS value.";
-    }
-    leaf inner-cos {
-      type uint8 {
-        range "0..7";
-      }
-      description "Set inner cos.";
-    }
-    leaf precedence {
-      type Precedence;
-      description "Sets the precedence value in the IP header.";
-    }
-    leaf precedence-tunnel {
-      type Precedence;
-      description "Sets the precedence tunnel value for ipsec.";
-    }
-    leaf mpls-experimental-top-most {
-      type uint8 {
-        range "0..7";
-      }
-      description 
-        "Sets the experimental value of the MPLS packet top-most
-         labels.";
-    }
-    leaf mpls-experimental-imposition {
-      type uint8 {
-         range "0..7";
-      }
-      description
-        "Sets the experimental value of the MPLS packet 
-         imposition labels.
-         Imposition can be used only in service policies that 
-         are attached in the ingress policy";
-    }
-    leaf srp-priority {
-      type uint8 {
-        range "0..7";
-      }
-      description 
-        "Sets the spatial reuse protocol priority value of an 
-         outgoing packet.";
-    }
-    leaf fr-de {
-        type uint8 {
-          range "0..1";
-        }
-        description "Set FrameRelay DE bit.";
-    }
-  }
-  
-  grouping CAC-RATE-VALUE {
-    description "CAC rate value.";
-    leaf value {
-      type uint32 {
-        range "1..4294967295";
-      }
-      must "../units" {
-        description "units must be set.";
-      }
-      description "Rate value.";
-    }
-    leaf units {
-      type Cac-rate-units;
-      description "Rate units.";
-    }
-  }
-  
-  grouping POLICE-ACTION {
-    description "Police action.";
-    leaf Transmit {
-      type empty;
-      description "Police action transmit.";
-    }
-    leaf drop {
-      type empty;
-      description "Police action drop.";
-    }
-    container set {
-      description "Police action packet marking.";
-      uses POLICY-MARK;
-    }
-  }
-  
-  grouping POLICY-MAP-RULE {
-    description "Class-map rule.";
-    list event {
-      key "event-type";
-      description "Policy event.";
-      leaf event-type {
-        type Event-type;
-        description "Event type.";
-      }
-      leaf event-mode-match-all {
-        when "count(../event-modematch-first) = 0" {
-          description "Event MUST have only one mode.";
-        }
-        type empty;
-        description "Execute all the matched classes.";
-      }
-      leaf event-modematch-first {
-        when "count(../event-modematch-all) = 0" {
-          description "Event MUST have only one mode.";
-        }
-        type empty;
-        description "Execute only the first matched class.";
-      }
-      list class {
-        key "class-name class-type";
-        description "Class-map rule.";
-        leaf class-name {
-          type string {
-            pattern "[a-zA-Z0-9][a-zA-Z0-9\._@$%+#:=<>\-]{0,62}";
-          }
-          description "Name of class.";
-        }
-        leaf class-type {
-          type Pmap-class-map-type;
-          description "Type of class.";
-        }
-        leaf class-execution-strategy {
-          type Execution-strategy;
-          description "Class execution strategy.";
-        }
-        list action-rule {
-          key "action-sequence-number";
-          description "Action rule.";
-          leaf action-sequence-number {
-            type uint16 {
-              range "1..65535";
-            }
-            description "Sequence number for this action.";
-          }
-          container activate-dynamic-template {
-            presence "This container is present only if actions is
-                      related to dynamic templates.";
-            description "Activate dynamic templates.";
-            leaf name {
-              type string;
-              mandatory true;
-              description "Dynamic template name.";
-            }
-            leaf aaa-list {
-              type string;
-              description "Name of the AAA method list.";
-            }
-          }
-          container authenticate {
-            description "Authentication related configuration.";
-            leaf aaa-list {
-              type string;
-              description "Name of the AAA method list.";
-            }
-          }
-          container authorize {
-            must "format or identifier" {
-              description "format or identifier must be set.";
-            }
-            presence "This container is present only if actions is
-                      related to authorization.";
-            description "Authorize.";
-            leaf aaa-list {
-              type string;
-              mandatory true;
-              description "Name of the AAA method list.";
-            }
-            leaf format {
-              type string;
-              description "Specify an Authorize format name.";
-            }
-            leaf identifier {
-              type Authorize-identifier;
-              description "Specify an Authorize format name.";
-            }
-            leaf password {
-              type string;
-              mandatory true;
-              description "Specify a password to be used for AAA
-                           request.";
-            }
-          }
-          container deactivate-dynamic-template {
-            presence "This container is present only if actions is
-                      related to dynamic templates.";
-            description "Deactivate dynamic templates.";
-            leaf name {
-              type string;
-              mandatory true;
-              description "Dynamic template name.";
-            }
-            leaf aaa-list {
-              type string;
-              description "Name of the AAA method list.";
-            }
-          }
-          leaf disconnect {
-            type empty;
-            description "Disconnect session.";
-          }
-          leaf monitor {
-            type empty;
-            description "Monitor session.";
-          }
-          container set-timer {
-            presence "This container is present only if actions is
-                      related to timer.";
-            description "Set a timer to execute a rule on its 
-                         expiry";
-            leaf timer-name {
-              type string;
-              mandatory true;
-              description "Name of the timer.";
-            }
-            leaf timer-value {
-              type uint32;
-              units "minutes";
-              mandatory true;
-              description "Timer value in minutes.";
-            }
-          }
-          container stop-timer {
-            description "Disable timer before it expires.";
-            leaf timer-name {
-              type string;
-              description "Name of the timer.";
-            }
-          }
-        }
-      }
-    }
-    list policy-map-rule {
-      key "class-name class-type";
-      description "Class-map rule.";
-      leaf class-name {
-        type string {
-          pattern "[a-zA-Z0-9][a-zA-Z0-9\._@$%+#:=<>\-]{0,62}";
-        }
-        description "Name of class-map.";
-      }
-      leaf class-type {
-        type Pmap-class-map-type;
-        description "Type of class-map.";
-      }
-      container shape {
-        must "rate" {
-          description "rate container must be present.";
-        }
-        description "Policy action shape.";
-        container rate {
-          description "Rate configuration.";
-          leaf value {
-            type uint32;
-            must "../unit" {
-              description "unit must be set.";
-            }
-            description "Shape bandwidth value.";
-          }
-          leaf unit {
-            type Bandwidth-units;
-            description "Shape bandwidth units.";
-          }
-        }
-        container burst {
-          description "Burst size configuration.";
-          leaf value {
-            type uint32;
-            must "../units" {
-              description "units must be set.";
-            }
-            description "Burst size value.";
-          }
-          leaf units {
-            type Threshold-units;
-            description "Burst size units.";
-          }
-        }
-      }
-      container min-bandwidth {
-        description "Policy action minimum bandwidth queue.";
-        leaf value {
-          type uint32;
-          must "../unit" {
-            description "unit must be set.";
-          }
-          description "Minimum bandwidth value.";
-        }
-        leaf unit {
-          type Bandwidth-units;
-          description "Minimum bandwidth units.";
-        }
-      }
-      container bandwidth-remaining {
-        description "Policy action bandwidth remaining queue.";
-        leaf value {
-          type uint32;
-          must "../unit" {
-            description "unit must be set.";
-          }
-          description "Remaining bandwidth value.";
-        }
-        leaf unit {
-          type Bandwidth-remaining-units;
-          description "Remaining bandwidth units.";
-        }
-      }
-      container queue-limit {
-        description "Policy action queue limit.";
-        leaf value {
-          type uint32;
-          must "../unit" {
-            description "unit must be set.";
-          }
-          description "Remaining bandwidth value.";
-        }
-        leaf unit {
-          type Queue-units;
-          description "Remaining bandwidth units.";
-        }
-      }
-      leaf priority-level {
-        type uint8 {
-          range "1..7";
-        }
-        description "Priority level.";
-      }
-      leaf default-red {
-        type empty;
-        description "Default random early detection";
-      }
-      leaf ecn-red {
-        type empty;
-        description "ECN based random early detection";
-      }
-      list random-detect {
-        key "threshold-min-value threshold-min-units "+
-            "threshold-max-value threshold-max-units";
-        description "Random early detection.
-                     All RED profiles in a class must be based
-                     on the same field.";
-        leaf threshold-min-value {
-          type uint32;
-          description "Minimum RED threshold value.";
-        }
-        leaf threshold-min-units {
-          type Threshold-units;
-          description "Minimum RED threshold units.";
-        }
-        leaf threshold-max-value {
-          type uint32;
-          description "Maximum RED threshold value.";
-        }
-        leaf threshold-max-units {
-          type Threshold-units;
-          description "Maximum RED threshold units.";
-        }
-        leaf-list cos {
-          type Dscp-range;
-          max-elements 8;
-          description "WRED based on CoS.";
-        }
-        leaf-list discard-class {
-          type Cos;
-          max-elements 8;
-          description "WRED based on discard class.";
-        }
-        leaf-list dscp {
-          type Dscp-range;
-          max-elements 8;
-          description "WRED based on DSCP.";
-        }
-        leaf-list mpls-exp {
-          type Cos;
-          max-elements 8;
-          description "MPLS Experimental value based WRED.";
-        }
-        leaf-list precedence {
-          type Precedence;
-          max-elements 8;
-          description "WRED based on precedence.";
-        }
-        leaf dei {
-          type uint8 {
-            range "0..1";
-          }
-          description "DEI based WRED.";
-        }
-      }
-      container set {
-        description "Policy action packet marking.";
-        uses POLICY-MARK;
-      }
-      container police {
-        must "rate" {
-          description "rate container must be present.";
-        }
-        description "Configures traffic policing action.";
-        container rate {
-          description "Rate configuration.";
-          leaf value {
-            type uint32;
-            must "../units" {
-              description "units must be set.";
-            }
-            description "Rate value.";
-          }
-          leaf units {
-            type Rate-units;
-            description "Rate units.";
-          }
-        }
-        container peak-rate {
-          description "Peak rate configuration.";
-          leaf value {
-            type uint32;
-            must "../units" {
-              description "units must be set.";
-            }
-            description "Peak rate value.";
-          }
-          leaf units {
-            type Rate-units;
-            description "Peak rate units.";
-          }
-        }
-        container burst {
-          description "Burst configuration.";
-          leaf value {
-            type uint32;
-            must "../units" {
-              description "units must be set.";
-            }
-            description "Burst value.";
-          }
-          leaf units {
-            type Threshold-units;
-            description "Burst units.";
-          }
-        }
-        container peak-burst {
-          description "Peak burst configuration.";
-          leaf value {
-            type uint32;
-            must "../units" {
-              description "units must be set.";
-            }
-            description "Peak burst value.";
-          }
-          leaf units {
-            type Threshold-units;
-            description "Peak burst units.";
-          }
-        }
-        container conform-action {
-          description 
-            "Configures the action to take on packets that conform 
-             to the rate limit.";
-          uses POLICE-ACTION;
-        }
-        container exceed-action {
-          description 
-            "Configures the action to take on packets that exceed 
-             the rate limit.";
-          uses POLICE-ACTION;
-        }
-        container violate-action {
-          description
-            "Configures the action to take on packets that violate
-             the rate limit.";
-          uses POLICE-ACTION;
-        }
-      }
-      container service-policy {
-        description 
-          "Configure a child service policy.";
-        leaf policy-name {
-          type string {
-            pattern "[a-zA-Z0-9][a-zA-Z0-9\._@$%+#:=<>\-]{0,62}";
-          }
-          description "Name of service-policy.";
-        }
-        leaf type {
-          type Service-policy-type;
-          description "Type of service-policy.";
-        }
-      }
-      container cac-local {
-        description "Policy action CAC.";
-        container rate {
-          description "The rate allocated for all flows.";
-          uses CAC-RATE-VALUE;
-        }
-        container flow-rate {
-          description "The rate allocated per flow.";
-          uses CAC-RATE-VALUE;
-        }
-        leaf flow-idle-timeout {
-          type Idle-timeout;
-          description "The interval after which a flow is removed, 
-                       if there is no activity.
-                       If timeout is 0 this flow does not expire.";
-        }
-      }
-      container flow-params {
-        description "Policy flow monitoring action.";
-        leaf max-flow {
-          type uint16 {
-            range "0..4096";
-          }
-          description 
-            "Max simultaneous flows monitored per policy class";
-        }
-        leaf interval-duration {
-          type uint32;
-          units "seconds";
-          description "Monitored interval duration.";
-        }
-        leaf history {
-          type uint32;
-          description 
-            "Keep stats/metrics on box for so many intervals.";
-        }
-        leaf timeout {
-          type uint32;
-          units "seconds";
-          description "Declare a flow dead if no packets received in
-                       so much time";
-        }
-      }
-      container metrics-ipcbr {
-        description "Policy IP-CBR metric action.";
-        container rate {
-          description "Nominal per-flow data rate.";
-          leaf layer3 {
-            type uint32;
-            units "bps";
-            description "Nominal rate specified at the L3 (IP).";
-          }
-          leaf packet {
-            type uint32;
-            units "pps";
-            description "Nominal IP layer packet rate (in pps).";
-          }
-          leaf media {
-            type uint32 {
-              range "1..3000000000";
-            }
-            units "bps";
-            description 
-              "Nominal data rate of the media flow (ip payload).";
-          }
-        }
-        container media-packet {
-          description "Media-packet structure.";
-          leaf size {
-            type uint16;
-            units "bytes";
-            description "Nominal size of the media-packet.";
-          }
-          leaf count-in-layer3 {
-            type uint8 {
-              range "1..64";
-            }
-            units "packets";
-            description 
-              "Nominal number of media packets in an IP payload.";
-          }
-        }
-      }
-      container react {
-        description "Policy action react.";
-        leaf descrition {
-          type string;
-          description "String describing the react statement.";
-        }
-        container action {
-          description "Action on alert.";
-          leaf syslog {
-            type empty;
-            description "Syslog.";
-          }
-          leaf snmp {
-            type empty;
-            description "SNMP.";
-          }
-        }
-        container alarm {
-          description "Alaram settings.";
-          container type {
-            description "Alarm type.";
-            leaf discrete {
-              type empty;
-              description "Discrete alarm type.";
-            }
-            leaf group-count {
-              type uint16;
-              units "number of flows";
-              description "Number of flows to reach before 
-                           triggering alarm";
-            }
-            leaf group-percent {
-              type uint16;
-              units "percentage";
-              description "Percent to reach before triggering alarm";
-            }
-          }
-          leaf severity {
-            type Alarm-severity;
-            description "Severity of the alarm.";
-          }
-        }
-        container treshold {
-          description "Alarm threshold settings.";
-          container trigger-value {
-            description "Alarm trigger value settings.";
-            leaf greater-than {
-              type string;
-              description "Greater than";
-            }
-            leaf greater-than-equal {
-              type string;
-              description "Greater than equal";
-            }
-            leaf less-than {
-              type string;
-              description "Less than";
-            }
-            leaf less-than-equal {
-              type string;
-              description "Less than equal";
-            }
-            leaf range {
-              type string;
-              description "Range";
-            }
-          }
-          container trigger-type {
-            description "Alarm trigger type settings.";
-            leaf immediate {
-              type empty;
-              description "Immediate trigger.";
-            }
-            leaf average {
-              type uint32;
-              description "Trigger averaged over N intervals.";
-            }
-          }
-        }
-        leaf criterion-delay-factor {
-          type empty;
-          description "React criterion delay factor.";
-        }
-        leaf criterion-media-stop {
-          type empty;
-          description "React criterion media stop.";
-        }
-        leaf criterion-mrv {
-          type empty;
-          description "React criterion mrv.";
-        }
-        leaf criterion-flow-count {
-          type empty;
-          description "React criterion flow count.";
-        }
-        leaf criterion-packet-rate {
-          type empty;
-          description "React criterion packet rate.";
-        }
-      }
-      container pbr {
-        description "Policy action PBR.";
-        leaf http-redirect {
-          type string;
-          description "Policy action http redirect.
-                       Redirect to this url.";
-        }
-        leaf pbr-transmit {
-          type empty;
-          description "Policy action PBR transmit.";
-        }
-        leaf pbr-drop {
-          type empty;
-          description "Policy action PBR drop.";
-        }
-        container pbr-forward {
-          description "Policy action PBR forward.";
-          leaf default {
-            type empty;
-            description "Use system default routing table.";
-          }
-          container next-hop {
-            description "Use specific next-hop.
-                         Here we present 5 different combination 
-                         for the pbf next-hop.
-                          1. vrf with v6 address
-                          2. vrf with v4 address
-                          3. vrf 
-                          4. v4 address
-                          5. v6 address";
-            leaf vrf {
-              type string;
-              description "VRF name.";
-            }
-            leaf ipv4-address {
-              type inet:ipv4-address;
-              description "IPv4 address.";
-            }
-            leaf ipv6-address {
-              type inet:ipv6-address;
-              description "IPv6 address.";
-            }
-          }
-        }
-        container set {
-          description "PBR action packet marking.";
-          uses POLICY-MARK;
-        }
-      }
-      leaf service-fragment {
-        type string;
-        description "Policy action service fragment. 
-                     Service fragment name";
-      }
-      leaf fragment {
-        type string;
-        description "Policy action fragment. Fragment name";
-      }
-    }
-    leaf description {
-      type string;
-      description "Description for this policy-map.";
-    }
-  }
-  
-  container policy-manager {
-    description "Global Policy Manager configuration.";
-    
-    container class-maps {
-      description "Class-maps configuration.";
-      list class-map {
-        key "type name";
-        description "Class-map configuration.";
-        leaf type {
-          type Class-map-type;
-          description "Type of class-map.";  
-        }
-        leaf name {
-          type string {
-            pattern "[a-zA-Z0-9][a-zA-Z0-9\._@$%+#:=<>\-]{0,62}";
-          }
-          description "Name of class-map.";
-        }
-        
-        uses CLASS-MAP-RULE;
-      }
-    }
-    
-    container policy-maps {
-      description "Policy-maps configuration.";
-      list policy-map {
-        key "type name";
-        description "Policy-map configuration.";
-        leaf type {
-          type Policy-map-type;
-          description "Type of policy-map.";
-        }
-        leaf name {
-          type string {
-            pattern "[a-zA-Z0-9][a-zA-Z0-9\._@$%+#:=<>\-]{0,62}";
-          }
-          description "Name of policy-map.";
-        }
-        
-        uses POLICY-MAP-RULE;
-      }
-    }
-  }
-}
\ No newline at end of file
diff --git a/cisco-xrmodels/src/main/yang/Cisco-IOS-XR-infra-policymgr-cfg@2016-12-15.yang b/cisco-xrmodels/src/main/yang/Cisco-IOS-XR-infra-policymgr-cfg@2016-12-15.yang
new file mode 100755 (executable)
index 0000000..11f36b9
--- /dev/null
@@ -0,0 +1,1879 @@
+module Cisco-IOS-XR-infra-policymgr-cfg {
+   namespace 
+     "http://cisco.com/ns/yang/Cisco-IOS-XR-infra-policymgr-cfg";
+   
+   prefix "infra-policymgr-cfg";
+     
+   import ietf-inet-types { 
+     prefix inet;
+   }
+     
+   organization "Cisco Systems, Inc.";
+   contact
+     "Cisco Systems, Inc.
+      Customer Service
+      Postal: 170 West Tasman Drive
+      San Jose, CA 95134
+      Tel: +1 800 553-NETS
+      E-mail: cs-yang@cisco.com";
+   description
+     "This module contains a collection of YANG definitions
+      for Cisco IOS-XR ASR9k policy manager configuration.
+      Copyright (c) 2013, 2015-2016 by Cisco Systems, Inc.
+      All rights reserved.";
+   revision "2016-12-15" {
+     description
+       "IOS XR 6.1.3 revision.";
+   }
+
+   revision "2015-05-18" {
+     description
+       "IOS XR 5.3.2 revision.";
+   }
+   revision "2013-07-22" {
+     description
+       "Initial revision.";
+   }
+   typedef mac-address {
+      type string {
+        pattern '[0-9a-fA-F]{4}(\.[0-9a-fA-F]{4}){2}';
+      }
+      description
+       "The mac-address type represents a MAC address.
+        The canonical representation uses lowercase characters.
+        It is made of three groups of four hexadecimal digits
+        separated by dots (.)";
+    }
+   typedef Class-map-type {
+     type enumeration {
+       enum qos {
+         value 1;
+         description "QoS Classmap.";
+       }
+       enum traffic {
+         value 3;
+         description "TRAFFIC Classmap.";
+       }
+       enum control {
+         value 4;
+         description "Control Subscriber Classmap.";
+       }
+     }
+     description "Policy manager class-map type.";
+   }
+   typedef Alarm-severity {
+     type string {
+       pattern "(informational)|(notification)|(warning)|(error)|"+
+               "(critical)|(alert)|(emergency)";
+     }
+     description "Alaram severity types.";
+   }
+   typedef Policy-map-type {
+     type enumeration {
+       enum qos {
+         value 1;
+         description "QoS Policymap";
+       }
+       enum pbr {
+         value 2;
+         description "PBR Policymap";
+       }
+       enum traffic {
+         value 3;
+         description "TRAFFIC Policymap";
+       }
+       enum subscriber-control {
+         value 4;
+         description "SUBSCRIBER-CONTROL Policymap";
+       }
+       enum redirect {
+         value 6;
+         description "REDIRECT Policy map";
+       }
+       enum flow-monitor {
+         value 7;
+         description "FLOWMONITOR Policy map";
+       }
+     }
+     description "Policy manager policy-map type.";
+   }
+   typedef Service-policy-type {
+     type string {
+       pattern "(PBR)|(QOS)|(REDIRECT)|(TRAFFIC)|"+
+                "(pbr)|(qos)|(redirect)|(traffic)";
+     }
+     description "Policy manager service-policy type.";
+   }
+   typedef Pmap-class-map-type {
+     type enumeration {
+       enum qos {
+         value 1;
+         description "QoS Classmap.";
+       }
+       enum traffic {
+         value 2;
+         description "TRAFFIC Classmap.";
+       }
+       enum subscriber-control {
+         value 3;
+         description "Subscriber Control Classmap.";
+       }
+     }
+     description "Policy manager class-map type.";
+   }
+   typedef Bandwidth-units {
+     type string {
+       pattern "(bps)|(kbps)|(mbps)|(gbps)|(percent)|(per-million)|"+
+               "(per-thousand)";
+     }
+     description "Supported units for bandwidth.
+                  bps          - units in Bits/Sec
+                  kbps         - units in KiloBits/Sec
+                  mbps         - units in MegaBits/Sec
+                  gbps         - units in GigaBits/Sec
+                  percent      - units in Percentage
+                  per-million  - parts per-million bandwidth value
+                  per-thousand - Parts per-thousand bandwidth value";
+   }
+   typedef Bandwidth-remaining-units {
+     type string {
+       pattern "(percent)|(ratio)";
+     }
+     description "Supported units for bandwidth remaining.
+                  percent      - units in Percentage
+                  ratio        - units in Ratio";
+   }
+   typedef Rate-units {
+     type string {
+       pattern "(bps)|(kbps)|(mbps)|(gbps)|(pps)|(percent)|(cellsps)";
+     }
+     description "Supported units for police rate or peak-rate.
+                  bps     - units in Bits/Sec
+                  kbps    - units in KiloBits/Sec
+                  mbps    - units in MegaBits/Sec
+                  gbps    - units in GigaBits/Sec
+                  pps     - units in Packets/Sec
+                  percent - units in Percentage
+                  cellsps - units in Cells/Sec";
+   }
+   typedef Cac-rate-units {
+     type string {
+       pattern "(bps)|(kbps)|(mbps)|(gbps)|(cellsps)";
+     }
+     description "Supported units for CAC rate or flow-rate.
+                  bps     - units in Bits/Sec
+                  kbps    - units in KiloBits/Sec
+                  mbps    - units in MegaBits/Sec
+                  gbps    - units in GigaBits/Sec
+                  cellsps - units in Cells/Sec";
+   }
+   typedef Queue-units {
+     type string {
+       pattern "(bytes)|(kbytes)|(mbytes)|(gbytes)|(us)|(ms)|"+
+               "(packets)|(cells)|(percent)";
+     }
+     description "Supported units for queue.
+                  bytes   - units in Bytes
+                  kbytes  - units in KiloBytes
+                  mbytes  - units in MegaBytes
+                  gbytes  - units in Gigabytes
+                  us      - units in Microseconds
+                  ms      - units in Milliseconds
+                  packets - units in Packets
+                  cells   - units in Cells
+                  percent - units in Percent";
+   }
+   
+   typedef Threshold-units {
+     type string {
+       pattern "(bytes)|(kbytes)|(mbytes)|(gbytes)|(us)|(ms)|"+
+               "(packets)|(cells)";
+     }
+     description "Supported units for RED threshold.
+                  bytes   - units in Bytes
+                  kbytes  - units in KiloBytes
+                  mbytes  - units in MegaBytes
+                  gbytes  - units in GigaBytes
+                  us      - units in Microseconds
+                  ms      - units in Milliseconds
+                  packets - units in Packets
+                  cells   - units in Cells";
+   }
+   
+   typedef Pfc-units {
+    type string {
+      pattern "(bytes)|(kbytes)|(mbytes)|(gbytes)|(us)|(ms)|"+
+              "(packets)|(cells)";
+    }
+    description "Supported units for pfc.
+                 bytes   - units in Bytes
+                 kbytes  - units in KiloBytes
+                 mbytes  - units in MegaBytes
+                 gbytes  - units in Gigabytes
+                 us      - units in Microseconds
+                 ms      - units in Milliseconds
+                 packets - units in Packets
+                 cells   - units in Cells";
+  }
+   typedef Float-str {
+     type string {
+       pattern "[0-9]+(\.[0-9]+)?";
+     }
+     description "Floating point number string representation.";
+   }
+   
+   typedef Dscp {
+     type string {
+       pattern "([0-9]|[1-5][0-9]|6[0-3])|"+
+               "(af11)|(af12)|(af13)|(af21)|(af22)|(af23)|(af31)|"+
+               "(af32)|(af33)|(af41)|(af42)|(af43)|(ef)|(default)|"+
+               "(cs1)|(cs2)|(cs3)|(cs4)|(cs5)|(cs6)|(cs7)";
+     }
+     description "DSCP value string representation.
+                  Should be single value 0..63 or predefined string.";
+   }
+   typedef Dscp-range {
+     type string {
+       pattern "([0-9]|[1-5][0-9]|6[0-3])|"+
+               "(([0-9]|[1-5][0-9]|6[0-3])-"+
+               "([0-9]|[1-5][0-9]|6[0-3]))|"+
+               "(af11)|(af12)|(af13)|(af21)|(af22)|(af23)|(af31)|"+
+               "(af32)|(af33)|(af41)|(af42)|(af43)|(ef)|(default)|"+
+               "(cs1)|(cs2)|(cs3)|(cs4)|(cs5)|(cs6)|(cs7)";
+     }
+     description "DSCP value or range string representation.
+                  Should be single value 0..63 or predefined string 
+                  or range <min>-<max>.";
+   }
+   
+   typedef Num-range {
+     type string {
+       pattern "(\d+)|(\d+\-\d+)";
+     }
+     description "Numeric value or range string representation.
+                  Should be single value or range <min>-<max>.";
+   }
+   
+   typedef Protocol {
+     type string {
+       pattern 
+         "([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])|"+
+         "(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\-"+
+         "([1-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5]))|"+
+         "((ahp)|(dhcpv4)|(dhcpv6)|(eigrp)|(esp)|(gre)|(icmp)|"+
+         "(igmp)|(igrp)|(ipinip)|(ipv4)|(ipv6)|(ipv6icmp)|(mpls)|"+
+         "(nos)|(ospf)|(pcp)|(pim)|(ppp)|(sctp)|(tcp)|(udp))";
+     }
+     description "Numeric value or range or string representation.
+                  Should be single value or range 0..255.";
+   }
+   
+   typedef Ethertype {
+     type string {
+       pattern 
+         "((153[6-9]|15[4-9][0-9]|1[6-9][0-9][0-9]|[2-9][0-9][0-9][0-9])|"+
+         "([1-5][0-9][0-9][0-9][0-9]|6[0-4][0-9][0-9][0-9])|"+
+         "(65[0-4][0-9][0-9]|655[0-2][0-9]|6553[0-5]))|"+
+         "((arp)|(ipv4)|(ipv6))";
+     }
+     description "Numeric value or string representation.
+                  Should be single value 1536..65535 or predefined string.";
+   }
+   typedef Precedence {
+     type union {
+       type uint8 {
+         range "0..7";
+       }
+       type string {
+         pattern "(critical)|(flash)|(flash-override)|(immediate)|"+
+                 "(internet)|(network)|(priority)|(routine)";
+       }
+     }
+     description "Precedence value.
+                  critical        Critical precedence (5)
+                  flash           Flash precedence (3)
+                  flash-override  Flash override precedence (4)
+                  immediate       Immediate precedence (2)
+                  internet        Internetwork control precedence (6)
+                  network         Network control precedence (7)
+                  priority        Priority precedence (1)
+                  routine         Routine precedence (0)";
+   }
+   
+   typedef Cos {
+     type uint8 {
+       range "0..7";
+     }
+     description "Cos value.";
+   }
+   typedef Idle-timeout-number {
+     type uint16 {
+       range "10..2550";
+     }
+     units "seconds";
+     description "String that idle-timeout can take.";
+   }
+   
+   typedef Idle-timeout-string {
+     type string {
+       pattern "(None)|(none)";
+     }
+     description "This flow does not expire.";
+   }
+   
+   typedef Idle-timeout {
+     type union {
+       type Idle-timeout-number;
+       type Idle-timeout-string;
+     }
+     description "Idle timeout.";
+   }
+   
+   typedef Event-type {
+     type enumeration {
+       enum account-logoff {
+         description "Account logoff event.";
+       }
+       enum account-logon {
+         description "Account logon event.";
+       }
+       enum authentication-failure {
+         description "Authentication failure event.";
+       }
+       enum authentication-no-response {
+         description "Authentication no response event.";
+       }
+       enum authorization-failure {
+         description "Authorization failure event.";
+       }
+       enum authorization-no-response {
+         description "Authorization no response event.";
+       }
+       enum credit-exhausted {
+         description "Credit exhaustion event.";
+       }
+       enum exception {
+         description "Exception event.";
+       }
+       enum idle-timeout {
+         description "Idle timeout event.";
+       }
+       enum quota-depleted {
+         description "Quota depletion event.";
+       }
+       enum service-start {
+         description "Service start event.";
+       }
+       enum service-stop {
+         description "Service stop event.";
+       }
+       enum session-activate {
+         description "Session activate event.";
+       }
+       enum session-start {
+         description "Session start event.";
+       }
+       enum session-stop {
+         description "Session stop event.";
+       }
+       enum timer-expiry {
+         description "Timer expiry event.";
+       }
+     }
+     description "Event type.";
+   }
+   
+   typedef Execution-strategy {
+     type enumeration {
+       enum do-all {
+         description "Do all actions.";
+       }
+       enum do-until-failure {
+         description "Do all actions until failure.";
+       }
+       enum do-until-success {
+         description "Do all actions until success.";
+       }
+     }
+     description "Executuion strategy.";
+   }
+   
+   typedef Authorize-identifier {
+     type enumeration {
+       enum circuit-id {
+         description "Authorize circuit ID.";
+       }
+       enum dhcp-client-id {
+         description "Authorize dhcp client ID.";
+       }
+       enum remote-id {
+         description "Authorize remote ID.";
+       }
+       enum source-address-ipv4 {
+         description "Authorize source IPv4 address.";
+       }
+       enum source-address-ipv6 {
+         description "Authorize source IPv6 address.";
+       }
+       enum source-address-mac {
+         description "Authorize source MAC address.";
+       }
+       enum username {
+         description "Authorize username.";
+       }
+     }
+     description "Authorize identifier.";
+   }
+   
+   grouping MATCH {
+     description "Supported 'match' or 'match-not' actions.";
+     leaf-list ipv4-dscp {
+       type Dscp-range;
+       max-elements 8;
+       description "Match IPv4 DSCP.";
+     }
+     leaf-list ipv6-dscp {
+       type Dscp-range;
+       max-elements 8;
+       description "Match IPv6 DSCP.";
+     }
+     leaf-list dscp {
+       type Dscp-range;
+       max-elements 8;
+       description "Match DSCP.";
+     }
+     leaf-list ipv4-precedence {
+       type Precedence;
+       max-elements 8;
+       description "Match IPv4 precedence.";
+     }
+     leaf-list ipv6-precedence {
+       type Precedence;
+       max-elements 8;
+       description "Match IPv6 precedence.";
+     }
+     leaf-list precedence {
+       type Precedence;
+       max-elements 8;
+       description "Match precedence.";
+     }
+     leaf-list qos-group {
+       type Num-range;
+       max-elements 8;
+       description "Match QoS group.
+                    Should be value 0..512 or range.";
+     }
+     leaf-list traffic-class {
+       type Num-range;
+       max-elements 8;
+       description "Match Traffic Class.
+                    Should be value 0..7 or range.";
+     }
+     leaf-list cos {
+       type Cos;
+       max-elements 8;
+       description "Match CoS.";
+     }
+     leaf-list inner-cos {
+       type Cos;
+       max-elements 8;
+       description "Match inner CoS.";
+     }
+     leaf dei {
+       type uint8 {
+         range "0..1";
+       }
+       description "Match DEI bit.";
+     }
+     leaf dei-inner {
+       type uint8 {
+         range "0..1";
+       }
+       description "Match DEI INNER  bit.";
+     }
+     leaf-list protocol {
+       type Protocol;
+       max-elements 7;
+       description "Match protocol.";
+     }
+     leaf ipv4-acl {
+       type string {
+         length "1..64";
+       }
+       description "Match IPv4 ACL.";
+     }
+     leaf ipv6-acl {
+       type string {
+         length "1..64";
+       }
+       description "Match IPv6 ACL.";
+     }
+     leaf ethernet-services-acl {
+       type string {
+         length "1..64";
+       }
+       description "Match Ethernet Services";
+     }
+     leaf-list mpls-experimental-topmost {
+       type Cos;
+       max-elements 8;
+       description "Match MPLS experimental topmost label.";
+     }
+     leaf-list mpls-experimental-imposition {
+       type Cos;
+       max-elements 8;
+       description "Match MPLS experimental imposition label.";
+     }
+     leaf-list discard-class {
+       type Cos;
+       max-elements 8;
+       description "Match discard class.";
+     }
+     leaf-list ipv4-packet-length {
+       type Num-range;
+       max-elements 8;
+       description "Match IPv4 packet length.
+                    Should be value 0..65535 or range.";
+     }
+     leaf-list ipv6-packet-length {
+       type Num-range;
+       max-elements 8;
+       description "Match IPv6 packet length. 
+                    Should be value 0..65535 or range.";
+     }
+     leaf-list packet-length {
+       type Num-range;
+       max-elements 8;
+       description "Match packet length. 
+                    Should be value 0..65535 or range.";
+     }
+     leaf mpls-disposition-ipv4-access-list {
+       type string {
+         length "1..32";
+       }
+       description "Match MPLS Label Disposition IPv4 access list.";
+     }
+     leaf mpls-disposition-ipv6-access-list {
+       type string {
+         length "1..32";
+       }
+       description "Match MPLS Label Disposition IPv6 access list.";
+     }
+     leaf-list vlan {
+       type Num-range;
+       max-elements 8;
+       description "Match VLAN ID.";
+     }
+     leaf-list inner-vlan {
+       type Num-range;
+       max-elements 8;
+       description "Match inner VLAN ID.";
+     }
+     leaf-list flow-tag {
+       type Num-range;
+       max-elements 8;
+       description "Match flow-tag. Should be value 1..63 or range.";
+     }
+     leaf-list ethertype {
+       type Ethertype;
+       max-elements 8;
+       description "Match Ethertype.";
+     }
+     list destination-address-ipv4 {
+       key "address netmask";
+       max-elements 8;
+       description "Match destination IPv4 address.";
+       leaf address {
+         type inet:ipv4-address-no-zone;
+         description "IPv4 address.";
+       }
+       leaf netmask {
+         type inet:ipv4-address-no-zone;
+         description "IPv4 netmask.";
+       }
+     }
+     list destination-address-ipv6 {
+       key "address prefix-length";
+       max-elements 8;
+       description "Match destination IPv6 address.";
+       leaf address {
+         type inet:ipv6-address-no-zone;
+         description "IPv6 address.";
+       }
+       leaf prefix-length {
+         type uint8 {
+           range "0..128";
+         }
+         description "IPv6 prefix length.";
+       }
+     }
+     leaf-list destination-port {
+       type Num-range;
+       max-elements 8;
+       description "Match destination port. 
+                    Should be value 0..65535 or range.";
+     }
+     leaf-list fragment-type {
+       type string {
+         pattern "(first-fragment)|(is-fragment)|(last-fragment)";
+       }
+       max-elements 3;
+       description "Match fragment type for a packet.";
+     }
+     leaf-list frame-relay-dlci {
+       type Num-range;
+       max-elements 8;
+       description "Match frame-relay DLCI value. 
+                    Should be value 16..1007 or range.";
+     }
+     leaf fr-de {
+         type uint8 {
+           range "0..1";
+         }
+         description "Set FrameRelay DE bit.";
+     }
+     leaf-list icmpv4-code {
+       type Num-range;
+       max-elements 8;
+       description "Match IPv4 ICMP code. 
+                    Should be value 0..255 or range.";
+     }
+     leaf-list icmpv4-type {
+       type Num-range;
+       max-elements 8;
+       description "Match IPv4 ICMP type. 
+                    Should be value 0..255 or range.";
+     }
+     leaf-list icmpv6-code {
+       type Num-range;
+       max-elements 8;
+       description "Match IPv6 ICMP code. 
+                    Should be value 0..255 or range.";
+     }
+     leaf-list icmpv6-type {
+       type Num-range;
+       max-elements 8;
+       description "Match IPv6 ICMP type. 
+                    Should be value 0..255 or range.";
+     }
+     list source-address-ipv4 {
+       key "address netmask";
+       max-elements 8;
+       description "Match source IPv4 address.";
+       leaf address {
+         type inet:ipv4-address-no-zone;
+         description "IPv4 address.";
+       }
+       leaf netmask {
+         type inet:ipv4-address-no-zone;
+         description "IPv4 netmask.";
+       }
+     }
+     list source-address-ipv6 {
+       key "address prefix-length";
+       max-elements 8;
+       description "Match source IPv6 address.";
+       leaf address {
+         type inet:ipv6-address-no-zone;
+         description "IPv6 address.";
+       }
+       leaf prefix-length {
+         type uint8 {
+           range "0..128";
+         }
+         description "IPv6 prefix length.";
+       }
+     }
+     leaf-list source-port {
+       type Num-range;
+       max-elements 8;
+       description "Match source port. 
+                    Should be value 0..65535 or range.";
+     }
+     leaf tcp-flag {
+       type uint16 {
+         range "0..4095";
+       }
+       description "Match TCP flags.";
+     }
+     leaf authen-status {
+       type string {
+         pattern "(authenticated)|(unauthenticated)";
+       }
+       description "Match authentication status.";
+     }
+     leaf-list circuit-id {
+       type string {
+         length "1..32";
+       }
+       max-elements 8;
+       description "Match Circuit ID."; 
+     }
+     leaf-list circuit-id-regex {
+       type string {
+         length "1..32";
+       }
+       max-elements 8;
+       description "Match Circuit id regex."; 
+     }
+     leaf-list dhcp-client-id {
+       type string {
+         length "1..32";
+       }
+       max-elements 8;
+       description "Match dhcp client ID."; 
+     }
+     leaf-list dhcp-client-id-regex {
+       type string {
+         length "1..32";
+       }
+       max-elements 8;
+       description "Match dhcp client id regex."; 
+     }
+     list domain-name {
+       key "name format";
+       max-elements 8;
+       description "Match domain name.";
+       leaf name {
+         type string {
+           length "1..32";
+         }
+         description "Domain name or regular expression.";
+       }
+       leaf format {
+         type string {
+           length "1..32";
+         }
+         description "Domain-format name.";
+       }
+     } 
+     list domain-name-regex {
+       key "regex format";
+       max-elements 8;
+       description "Match domain name.";
+       leaf regex {
+         type string {
+           length "1..32";
+         }
+         description "Domain name or regular expression.";
+       }
+       leaf format {
+         type string {
+           length "1..32";
+         }
+         description "Domain-format name.";
+       }
+     } 
+     leaf-list remote-id {
+       type string {
+         length "1..32";
+       }
+       max-elements 8;
+       description "Match remote ID."; 
+     }
+     leaf-list remote-id-regex {
+       type string {
+         length "1..32";
+       }
+       max-elements 8;
+       description "Match remote id regex."; 
+     }
+     leaf-list service-name {
+       type string {
+         length "1..32";
+       }
+       max-elements 8;
+       description "Match servicve name.";
+     }
+     leaf-list service-name-regex {
+       type string {
+         length "1..32";
+       }
+       max-elements 8;
+       description "Match servicve name regular expression.";
+     }
+     leaf-list timer {
+       type string {
+         length "1..32";
+       }
+       max-elements 8;
+       description "Match timer.";
+     }
+     leaf-list timer-regex {
+       type string {
+         length "1..32";
+       }
+       max-elements 8;
+       description "Match timer regular expression.";
+     }
+     leaf-list user-name {
+       type string {
+         length "1..32";
+       }
+       max-elements 8;
+       description "Match user name.";
+     }
+     leaf-list user-name-regex {
+       type string {
+         length "1..32";
+       }
+       max-elements 8;
+       description "Match user name regular expression.";
+     }
+     leaf-list source-mac {
+         type string;
+         max-elements 8;
+         description "Match source MAC address.";
+       }
+       leaf-list destination-mac {
+         type string;
+         max-elements 8;
+         description "Match destination MAC address.";
+       }
+        leaf vpls-control {
+          type empty;
+          description "Match VPLS control";
+         }
+         leaf vpls-broadcast{
+           type empty;
+           description "Match VPLS Broadcast";
+        }
+        leaf vpls-multicast {
+          type empty;
+          description "Match VPLS Multicast";
+         }
+        leaf vpls-known {
+          type empty;
+          description "Match VPLS Known";
+         }
+        leaf vpls-unknown {
+          type empty;
+          description "Match VPLS Unknown";
+         }
+   }
+   
+   grouping MATCH-MATCHNOT {
+     description "match or match-not containers.";
+     container match {
+       description "Match rules.";
+       uses MATCH;
+       
+       leaf atm-clp {
+         type uint8 {
+           range "0..1";
+         }
+        description "Match ATM CLP bit.";
+       }
+       leaf atm-oam {
+         type empty;
+         description "Match ATM OAM.";
+       }
+       leaf cac-admit {
+         type empty;
+         description "Match CAC admitted.";
+       }
+       leaf cac-unadmit {
+         type empty;
+         description "Match CAC unadmitted.";
+       }
+       container flow {
+         description "Match flow.";
+         leaf-list flow-key {
+           type string {
+             pattern "(SourceIP)|(DestinationIP)|(5Tuple)";
+           }
+           max-elements 2;
+           description "Configure the flow-key parameters.";
+         }
+         container flow-cache {
+           description "Configure the flow-cache parameters";
+           leaf idle-timeout {
+             type Idle-timeout;
+             description "Maximum time of inactivity for a flow.";
+           }
+         }
+       }
+     }
+     container match-not {
+       description "Match not rules.";
+       uses MATCH;
+       container flow {
+         description "Match flow.";
+         leaf-list flow-tag {
+           type uint16 {
+               range "1..63";
+           }
+           max-elements 2;
+           description "Configure the flow-tag parameters.";
+         }
+       }
+     }  
+   }
+   grouping CLASS-MAP-RULE {
+     description "Class-map rule";
+     leaf class-map-mode-match-any {
+       when "count(../class-map-mode-match-all) = 0" {
+           description "Class MUST have only one mode.";
+       }
+       type empty;
+       description "Match all match criteria";
+     }
+     leaf class-map-mode-match-all {
+       when "count(../class-map-mode-match-any) = 0" {
+           description "Class MUST have only one mode.";
+       }
+       type empty;
+       description "Match any match criteria.";
+     }
+     uses MATCH-MATCHNOT;
+     leaf description {
+       type string;
+       description "Description for this policy-map.";
+     }
+   }
+   
+   grouping POLICY-MARK {
+     description "Policy packet marking actions.";
+     leaf dscp {
+       type Dscp;
+       description 
+         "Marks a packet by setting the DSCP in the ToS byte.";
+     }
+     leaf qos-group {
+       type uint16 {
+         range "0..512";
+       }
+       description
+         "Sets the QoS group identifiers on IPv4 or MPLS packets.
+          The set qos-group is supported only on an ingress policy.";
+     }
+     leaf traffic-class {
+       type uint8 {
+         range "0..7";
+       }
+       description
+         "Sets the Traffic class identifiers on IPv4 or MPLS packets.";
+     }
+     leaf discard-class {
+       type uint8 {
+         range "0..7";
+       }
+       description
+         "Sets the discard class on IPv4 or MPLS packets.
+          The discard-class can be used only in service policies 
+          that are attached in the ingress policy.";
+     }
+     leaf forward-class {
+       type uint8 {
+         range "0..7";
+       }
+       description 
+         "Sets the discard class.";
+     }
+     leaf df {
+       type uint8 {
+         range "0..1";
+       }
+       description "Set DF bit.";
+     }
+     leaf cos {
+       type uint8 {
+         range "0..7";
+       }
+       description 
+         "Sets the specific IEEE 802.1Q Layer 2 CoS value of an
+          outgoing packet.
+          This command should be used by a router if a user wants
+          to mark a packet that is being sent to a switch. 
+          Switches can leverage Layer 2 header information, 
+          including a CoS value marking. Packets entering an 
+          interface cannot be set with a CoS value.";
+     }
+     leaf inner-cos {
+       type uint8 {
+         range "0..7";
+       }
+       description "Set inner cos.";
+     }
+     leaf precedence {
+       type Precedence;
+       description "Sets the precedence value in the IP header.";
+     }
+     leaf precedence-tunnel {
+       type Precedence;
+       description "Sets the precedence tunnel value for ipsec.";
+     }
+     leaf mpls-experimental-top-most {
+       type uint8 {
+         range "0..7";
+       }
+       description 
+         "Sets the experimental value of the MPLS packet top-most
+          labels.";
+     }
+     leaf mpls-experimental-imposition {
+       type uint8 {
+          range "0..7";
+       }
+       description
+         "Sets the experimental value of the MPLS packet 
+          imposition labels.
+          Imposition can be used only in service policies that 
+          are attached in the ingress policy";
+     }
+     leaf srp-priority {
+       type uint8 {
+         range "0..7";
+       }
+       description 
+         "Sets the spatial reuse protocol priority value of an 
+          outgoing packet.";
+     }
+     leaf fr-de {
+         type uint8 {
+           range "0..1";
+         }
+         description "Set FrameRelay DE bit.";
+     }
+     leaf dei {
+         type uint8 {
+           range "0..1";
+         }
+         description "Set DEI bit.";
+     }
+     leaf dei-imposition {
+         type uint8 {
+           range "0..1";
+         }
+         description "Set DEI imposition bit.";
+     }
+     leaf source-address {
+         type inet:ipv4-address-no-zone;
+         description "Source IPv4 address.";
+     }
+     leaf destination-address {
+         type inet:ipv4-address-no-zone;
+         description "Destination IPv4 address.";
+     }
+   }
+   
+   grouping CAC-RATE-VALUE {
+     description "CAC rate value.";
+     leaf value {
+       type uint32 {
+         range "1..4294967295";
+       }
+       must "../units" {
+         description "units must be set.";
+       }
+       description "Rate value.";
+     }
+     leaf units {
+       type Cac-rate-units;
+       description "Rate units.";
+     }
+   }
+   
+   grouping POLICE-ACTION {
+     description "Police action.";
+     leaf Transmit {
+       type empty;
+       description "Police action transmit.";
+     }
+     leaf drop {
+       type empty;
+       description "Police action drop.";
+     }
+     container set {
+       description "Police action packet marking.";
+       uses POLICY-MARK;
+     }
+   }
+   
+   grouping POLICY-MAP-RULE {
+     description "Class-map rule.";
+     list event {
+       key "event-type";
+       description "Policy event.";
+       leaf event-type {
+         type Event-type;
+         description "Event type.";
+       }
+       leaf event-mode-match-all {
+         when "count(../event-mode-match-first) = 0" {
+           description "Event MUST have only one mode.";
+         }
+         type empty;
+         description "Execute all the matched classes.";
+       }
+       leaf event-mode-match-first {
+         when "count(../event-mode-match-all) = 0" {
+           description "Event MUST have only one mode.";
+         }
+         type empty;
+         description "Execute only the first matched class.";
+       }
+       list class {
+         key "class-name class-type";
+         description "Class-map rule.";
+         leaf class-name {
+           type string {
+             pattern "[a-zA-Z0-9][a-zA-Z0-9\._@$%+#:=<>\-]{0,62}";
+           }
+           description "Name of class.";
+         }
+         leaf class-type {
+           type Pmap-class-map-type;
+           description "Type of class.";
+         }
+         leaf class-execution-strategy {
+           type Execution-strategy;
+           description "Class execution strategy.";
+         }
+         list action-rule {
+           key "action-sequence-number";
+           description "Action rule.";
+           leaf action-sequence-number {
+             type uint16 {
+               range "1..65535";
+             }
+             description "Sequence number for this action.";
+           }
+           container activate-dynamic-template {
+             presence "This container is present only if actions is
+                       related to dynamic templates.";
+             description "Activate dynamic templates.";
+             leaf name {
+               type string;
+               mandatory true;
+               description "Dynamic template name.";
+             }
+             leaf aaa-list {
+               type string;
+               description "Name of the AAA method list.";
+             }
+           }
+           container authenticate {
+             description "Authentication related configuration.";
+             leaf aaa-list {
+               type string;
+               description "Name of the AAA method list.";
+             }
+           }
+           container authorize {
+             must "format or identifier" {
+               description "format or identifier must be set.";
+             }
+             presence "This container is present only if actions is
+                       related to authorization.";
+             description "Authorize.";
+             leaf aaa-list {
+               type string;
+               mandatory true;
+               description "Name of the AAA method list.";
+             }
+             leaf format {
+               type string;
+               description "Specify an Authorize format name.";
+             }
+             leaf identifier {
+               type Authorize-identifier;
+               description "Specify an Authorize format name.";
+             }
+             leaf password {
+               type string;
+               mandatory true;
+               description "Specify a password to be used for AAA
+                            request.";
+             }
+           }
+           container deactivate-dynamic-template {
+             presence "This container is present only if actions is
+                       related to dynamic templates.";
+             description "Deactivate dynamic templates.";
+             leaf name {
+               type string;
+               mandatory true;
+               description "Dynamic template name.";
+             }
+             leaf aaa-list {
+               type string;
+               description "Name of the AAA method list.";
+             }
+           }
+           leaf disconnect {
+             type empty;
+             description "Disconnect session.";
+           }
+           leaf monitor {
+             type empty;
+             description "Monitor session.";
+           }
+           container set-timer {
+             presence "This container is present only if actions is
+                       related to timer.";
+             description "Set a timer to execute a rule on its 
+                          expiry";
+             leaf timer-name {
+               type string;
+               mandatory true;
+               description "Name of the timer.";
+             }
+             leaf timer-value {
+               type uint32;
+               units "minutes";
+               mandatory true;
+               description "Timer value in minutes.";
+             }
+           }
+           container stop-timer {
+             description "Disable timer before it expires.";
+             leaf timer-name {
+               type string;
+               description "Name of the timer.";
+             }
+           }
+         }
+       }
+     }
+     list policy-map-rule {
+       key "class-name class-type";
+       description "Class-map rule.";
+       leaf class-name {
+         type string {
+           pattern "[a-zA-Z0-9][a-zA-Z0-9\._@$%+#:=<>\-]{0,62}";
+         }
+         description "Name of class-map.";
+       }
+       leaf class-type {
+         type Pmap-class-map-type;
+         description "Type of class-map.";
+       }
+       container shape {
+         must "rate" {
+           description "rate container must be present.";
+         }
+         description "Policy action shape.";
+         container rate {
+           description "Rate configuration.";
+           leaf value {
+             type uint32;
+             must "../unit" {
+               description "unit must be set.";
+             }
+             description "Shape bandwidth value.";
+           }
+           leaf unit {
+             type Bandwidth-units;
+             description "Shape bandwidth units.";
+           }
+         }
+         container burst {
+           description "Burst size configuration.";
+           leaf value {
+             type uint32;
+             must "../units" {
+               description "units must be set.";
+             }
+             description "Burst size value.";
+           }
+           leaf units {
+             type Threshold-units;
+             description "Burst size units.";
+           }
+         }
+       }
+       container min-bandwidth {
+         description "Policy action minimum bandwidth queue.";
+         leaf value {
+           type uint32;
+           must "../unit" {
+             description "unit must be set.";
+           }
+           description "Minimum bandwidth value.";
+         }
+         leaf unit {
+           type Bandwidth-units;
+           description "Minimum bandwidth units.";
+         }
+       }
+       container bandwidth-remaining {
+         description "Policy action bandwidth remaining queue.";
+         leaf value {
+           type uint32;
+           must "../unit" {
+             description "unit must be set.";
+           }
+           description "Remaining bandwidth value.";
+         }
+         leaf unit {
+           type Bandwidth-remaining-units;
+           description "Remaining bandwidth units.";
+         }
+       }
+       container queue-limit {
+         description "Policy action queue limit.";
+         leaf value {
+           type uint32;
+           must "../unit" {
+             description "unit must be set.";
+           }
+           description "Remaining bandwidth value.";
+         }
+         leaf unit {
+           type Queue-units;
+           description "Remaining bandwidth units.";
+         }
+       }
+       container pfc {
+        description "Policy action pfc."; 
+        leaf pfc-pause-set {
+            type empty;
+            description "Pfc Pause set value.";
+        }
+        container pfc-buffer-size {
+            leaf value {
+              type uint32;
+              must "../unit" {
+                description "unit must be set.";
+              }
+              description "Pfc buffer size value.";
+            }
+            leaf unit {
+              type Pfc-units;
+              description "Pfc buffer size units.";
+            }
+        } 
+        container pfc-pause-threshold {
+            leaf value {
+              type uint32;
+              must "../unit" {
+                description "unit must be set.";
+              }
+              description "Pfc pause threshold value.";
+            }
+            leaf unit {
+              type Pfc-units;
+              description "Pfc pause threshold units.";
+            }
+        } 
+        container pfc-resume-threshold {
+            leaf value {
+              type uint32;
+              must "../unit" {
+                description "unit must be set.";
+              }
+              description "Pfc resume threshold value.";
+            }
+            leaf unit {
+              type Pfc-units;
+              description "Pfc resume threshold units.";
+            }
+        }
+      }
+       leaf priority-level {
+         type uint8 {
+           range "1..7";
+         }
+         description "Priority level.";
+       }
+       leaf default-red {
+         type empty;
+         description "Default random early detection";
+       }
+       leaf ecn-red {
+         type empty;
+         description "ECN based random early detection";
+       }
+       list random-detect {
+         key "threshold-min-value threshold-min-units "+
+             "threshold-max-value threshold-max-units";
+         description "Random early detection.
+                      All RED profiles in a class must be based
+                      on the same field.";
+         leaf threshold-min-value {
+           type uint32;
+           description "Minimum RED threshold value.";
+         }
+         leaf threshold-min-units {
+           type Threshold-units;
+           description "Minimum RED threshold units.";
+         }
+         leaf threshold-max-value {
+           type uint32;
+           description "Maximum RED threshold value.";
+         }
+         leaf threshold-max-units {
+           type Threshold-units;
+           description "Maximum RED threshold units.";
+         }
+         leaf-list cos {
+           type Dscp-range;
+           max-elements 8;
+           description "WRED based on CoS.";
+         }
+         leaf-list discard-class {
+           type Cos;
+           max-elements 8;
+           description "WRED based on discard class.";
+         }
+         leaf-list dscp {
+           type Dscp-range;
+           max-elements 8;
+           description "WRED based on DSCP.";
+         }
+         leaf-list mpls-exp {
+           type Cos;
+           max-elements 8;
+           description "MPLS Experimental value based WRED.";
+         }
+         leaf-list precedence {
+           type Precedence;
+           max-elements 8;
+           description "WRED based on precedence.";
+         }
+         leaf dei {
+           type uint8 {
+             range "0..1";
+           }
+           description "DEI based WRED.";
+         }
+         leaf ecn {
+           type empty;
+           description "ECN based WRED.";
+         }
+       }
+       container set {
+         description "Policy action packet marking.";
+         uses POLICY-MARK;
+       }
+       container police {
+         must "rate" {
+           description "rate container must be present.";
+         }
+         description "Configures traffic policing action.";
+         container rate {
+           description "Rate configuration.";
+           leaf value {
+             type uint32;
+             must "../units" {
+               description "units must be set.";
+             }
+             description "Rate value.";
+           }
+           leaf units {
+             type Rate-units;
+             description "Rate units.";
+           }
+         }
+         container peak-rate {
+           description "Peak rate configuration.";
+           leaf value {
+             type uint32;
+             must "../units" {
+               description "units must be set.";
+             }
+             description "Peak rate value.";
+           }
+           leaf units {
+             type Rate-units;
+             description "Peak rate units.";
+           }
+         }
+         container burst {
+           description "Burst configuration.";
+           leaf value {
+             type uint32;
+             must "../units" {
+               description "units must be set.";
+             }
+             description "Burst value.";
+           }
+           leaf units {
+             type Threshold-units;
+             description "Burst units.";
+           }
+         }
+         container peak-burst {
+           description "Peak burst configuration.";
+           leaf value {
+             type uint32;
+             must "../units" {
+               description "units must be set.";
+             }
+             description "Peak burst value.";
+           }
+           leaf units {
+             type Threshold-units;
+             description "Peak burst units.";
+           }
+         }
+         container conform-action {
+           description 
+             "Configures the action to take on packets that conform 
+              to the rate limit.";
+           uses POLICE-ACTION;
+         }
+         container exceed-action {
+           description 
+             "Configures the action to take on packets that exceed 
+              the rate limit.";
+           uses POLICE-ACTION;
+         }
+         container violate-action {
+           description
+             "Configures the action to take on packets that violate
+              the rate limit.";
+           uses POLICE-ACTION;
+         }
+       }
+       container service-policy {
+         description 
+           "Configure a child service policy.";
+         leaf policy-name {
+           type string {
+             pattern "[a-zA-Z0-9][a-zA-Z0-9\._@$%+#:=<>\-]{0,62}";
+           }
+           description "Name of service-policy.";
+         }
+         leaf type {
+           type Service-policy-type;
+           description "Type of service-policy.";
+         }
+       }
+       container cac-local {
+         description "Policy action CAC.";
+         container rate {
+           description "The rate allocated for all flows.";
+           uses CAC-RATE-VALUE;
+         }
+         container flow-rate {
+           description "The rate allocated per flow.";
+           uses CAC-RATE-VALUE;
+         }
+         leaf flow-idle-timeout {
+           type Idle-timeout;
+           description "The interval after which a flow is removed, 
+                        if there is no activity.
+                        If timeout is 0 this flow does not expire.";
+         }
+       }
+       container flow-params {
+         description "Policy flow monitoring action.";
+         leaf max-flow {
+           type uint16 {
+             range "0..4096";
+           }
+           description 
+             "Max simultaneous flows monitored per policy class";
+         }
+         leaf interval-duration {
+           type uint32;
+           units "seconds";
+           description "Monitored interval duration.";
+         }
+         leaf history {
+           type uint32;
+           description 
+             "Keep stats/metrics on box for so many intervals.";
+         }
+         leaf timeout {
+           type uint32;
+           units "seconds";
+           description "Declare a flow dead if no packets received in
+                        so much time";
+         }
+       }
+       container metrics-ipcbr {
+         description "Policy IP-CBR metric action.";
+         container rate {
+           description "Nominal per-flow data rate.";
+           leaf layer3 {
+             type uint32;
+             units "bps";
+             description "Nominal rate specified at the L3 (IP).";
+           }
+           leaf packet {
+             type uint32;
+             units "pps";
+             description "Nominal IP layer packet rate (in pps).";
+           }
+           leaf media {
+             type uint32 {
+               range "1..3000000000";
+             }
+             units "bps";
+             description 
+               "Nominal data rate of the media flow (ip payload).";
+           }
+         }
+         container media-packet {
+           description "Media-packet structure.";
+           leaf size {
+             type uint16;
+             units "bytes";
+             description "Nominal size of the media-packet.";
+           }
+           leaf count-in-layer3 {
+             type uint8 {
+               range "1..64";
+             }
+             units "packets";
+             description 
+               "Nominal number of media packets in an IP payload.";
+           }
+         }
+       }
+       container react {
+         description "Policy action react.";
+         leaf descrition {
+           type string;
+           description "String describing the react statement.";
+         }
+         container action {
+           description "Action on alert.";
+           leaf syslog {
+             type empty;
+             description "Syslog.";
+           }
+           leaf snmp {
+             type empty;
+             description "SNMP.";
+           }
+         }
+         container alarm {
+           description "Alaram settings.";
+           container type {
+             description "Alarm type.";
+             leaf discrete {
+               type empty;
+               description "Discrete alarm type.";
+             }
+             leaf group-count {
+               type uint16;
+               units "number of flows";
+               description "Number of flows to reach before 
+                            triggering alarm";
+             }
+             leaf group-percent {
+               type uint16;
+               units "percentage";
+               description "Percent to reach before triggering alarm";
+             }
+           }
+           leaf severity {
+             type Alarm-severity;
+             description "Severity of the alarm.";
+           }
+         }
+         container threshold {
+           description "Alarm threshold settings.";
+           container trigger-value {
+             description "Alarm trigger value settings.";
+             leaf greater-than {
+               type string;
+               description "Greater than";
+             }
+             leaf greater-than-equal {
+               type string;
+               description "Greater than equal";
+             }
+             leaf less-than {
+               type string;
+               description "Less than";
+             }
+             leaf less-than-equal {
+               type string;
+               description "Less than equal";
+             }
+             leaf range {
+               type string;
+               description "Range";
+             }
+           }
+           container trigger-type {
+             description "Alarm trigger type settings.";
+             leaf immediate {
+               type empty;
+               description "Immediate trigger.";
+             }
+             leaf average {
+               type uint32;
+               description "Trigger averaged over N intervals.";
+             }
+           }
+         }
+         leaf criterion-delay-factor {
+           type empty;
+           description "React criterion delay factor.";
+         }
+         leaf criterion-media-stop {
+           type empty;
+           description "React criterion media stop.";
+         }
+         leaf criterion-mrv {
+           type empty;
+           description "React criterion mrv.";
+         }
+         leaf criterion-flow-count {
+           type empty;
+           description "React criterion flow count.";
+         }
+         leaf criterion-packet-rate {
+           type empty;
+           description "React criterion packet rate.";
+         }
+       }
+       leaf http-redirect {
+         type string;
+         description "Policy action http redirect.
+                     Redirect to this url.";
+       }
+       leaf pbr-transmit {
+         type empty;
+         description "Policy action PBR transmit.";
+       }
+       leaf pbr-drop {
+         type empty;
+         description "Policy action PBR drop.";
+       }
+       leaf decap-gre {
+         type empty;
+         description "Policy action DECAP GRE.";
+       }
+         container pbr-forward {
+           description "Policy action PBR forward.";
+           leaf default {
+             type empty;
+             description "Use system default routing table.";
+           }
+           container next-hop {
+             description "Use specific next-hop.
+                          Here we present 5 different combination 
+                          for the pbf next-hop.
+                           1. vrf with v6 address
+                           2. vrf with v4 address
+                           3. vrf 
+                           4. v4 address
+                           5. v6 address";
+             leaf vrf {
+               type string;
+               description "VRF name.";
+             }
+             leaf ipv4-address {
+               type inet:ipv4-address;
+               description "IPv4 address.";
+             }
+             leaf ipv6-address {
+               type inet:ipv6-address;
+               description "IPv6 address.";
+             }
+           }
+         }
+       leaf service-fragment {
+         type string;
+         description "Policy action service fragment. 
+                      Service fragment name";
+       }
+       leaf fragment {
+         type string;
+         description "Policy action fragment. Fragment name";
+       }
+       container service-function-path {
+         must "path-id" {
+           description "path id must be present.";
+         }
+         description "Policy action service function path.";
+         leaf path-id {
+           type uint32 {
+             range "1..16777215";
+           }
+           must "../index" {
+             description "index must be set.";
+           }
+           description "Service function path id.";
+         }
+         leaf index {
+           type uint8 {
+             range "1..255";
+           }
+           description "Service function path index.";
+         }
+         leaf metadata {
+           type string;
+           description "Service function path metadata name.";
+         }
+       }
+     }
+     leaf description {
+       type string;
+       description "Description for this policy-map.";
+     }
+   }
+  container policy-manager {
+    description "Global Policy Manager configuration.";
+
+     container class-maps {
+       description "Class-maps configuration.";
+       list class-map {
+         key "type name";
+         description "Class-map configuration.";
+         leaf type {
+           type Class-map-type;
+           description "Type of class-map.";  
+         }
+         leaf name {
+           type string {
+             pattern "[a-zA-Z0-9][a-zA-Z0-9\._@$%+#:=<>\-]{0,62}";
+           }
+           description "Name of class-map.";
+         }
+         
+         uses CLASS-MAP-RULE;
+       }
+     }
+     
+     container policy-maps {
+       description "Policy-maps configuration.";
+       list policy-map {
+         key "type name";
+         description "Policy-map configuration.";
+         leaf type {
+           type Policy-map-type;
+           description "Type of policy-map.";
+         }
+         leaf name {
+           type string {
+             pattern "[a-zA-Z0-9][a-zA-Z0-9\._@$%+#:=<>\-]{0,62}";
+           }
+           description "Name of policy-map.";
+         }
+         
+         uses POLICY-MAP-RULE;
+       }
+     }
+   }
+ }
\ No newline at end of file
index 8603d31ef66f619f759f9ffad30585a2fcdc51f2..1f826b80bd03e96ec7287d01ccf4a666a1c56d50 100644 (file)
@@ -1,4 +1,3 @@
 project_cfg: opendaylight
 project: UniMgr
 version: Neon
-
index 645279a12688d386fa704034f3acb31d4899f854..bd4ad09cf4095e323ecc08c1d60e0aab008f4b25 100644 (file)
@@ -12,6 +12,7 @@ import java.util.concurrent.ExecutionException;
 
 import org.opendaylight.unimgr.mef.nrp.common.ResourceActivatorException;
 import org.opendaylight.yang.gen.v1.urn.mef.yang.nrp._interface.rev180321.NrpConnectivityServiceAttrs;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev180307.ServiceType;
 
 /**
  * Interface of a driver that maps NRP concepts to the configuration of underlying infrastructure.
@@ -43,7 +44,7 @@ public interface ActivationDriver {
      * @param serviceId connectivity service id
      * @param context context
      */
-    void initialize(List<EndPoint> endPoints, String serviceId, NrpConnectivityServiceAttrs context);
+    void initialize(List<EndPoint> endPoints, String serviceId, NrpConnectivityServiceAttrs context, boolean isExclusive, ServiceType serviceType);
 
     /**
      * Performs the activation action.
index a58fa560043f884b926bc69e77f2a67daba50f39..c6e4202f92a2a0e10f4e23e457c59a4481d52f62 100644 (file)
@@ -12,6 +12,7 @@ import java.util.List;
 import java.util.concurrent.ExecutionException;
 
 import org.opendaylight.unimgr.mef.nrp.api.EndPoint;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev180307.ServiceType;
 
 /**
  * Device facing SPI for activating or deactivating a fragment of an NRP
@@ -27,7 +28,7 @@ public interface ResourceActivator {
      * @throws ExecutionException transaction execution failed
      * @throws InterruptedException transaction was interrupted
      */
-    void activate(List<EndPoint> endPoints, String serviceName)
+    void activate(List<EndPoint> endPoints, String serviceName, boolean isExclusive, ServiceType serviceType)
             throws  ResourceActivatorException, InterruptedException, ExecutionException;
 
     /**
@@ -38,6 +39,6 @@ public interface ResourceActivator {
      * @throws ExecutionException transaction execution failed
      * @throws InterruptedException transaction was interrupted
      */
-    void deactivate(List<EndPoint> endPoints, String serviceName)
+    void deactivate(List<EndPoint> endPoints, String serviceName, ServiceType serviceType)
             throws ResourceActivatorException, InterruptedException, ExecutionException;
 }
index e5a1604de754afe3487a327224b04d549be4e336..e41b758c406db069dd9588bb5f83af8ebe7f17cf 100644 (file)
@@ -8,9 +8,12 @@
 
 package org.opendaylight.unimgr.mef.nrp.impl;
 
+import java.util.ArrayList;
 import java.util.HashSet;
+import java.util.List;
 import java.util.Optional;
 import java.util.Set;
+import java.util.stream.Collectors;
 
 import javax.annotation.Nonnull;
 
@@ -18,7 +21,9 @@ import org.opendaylight.mdsal.binding.api.DataBroker;
 import org.opendaylight.unimgr.mef.nrp.api.RequestValidator;
 import org.opendaylight.unimgr.mef.nrp.common.NrpDao;
 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev180307.LocalClass;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev180307.PortRole;
 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev180307.CreateConnectivityServiceInput;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev180307.ServiceType;
 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev180307.UpdateConnectivityServiceInput;
 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev180307.connectivity.context.ConnectivityService;
 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev180307.update.connectivity.service.input.EndPoint;
@@ -97,7 +102,7 @@ public class DefaultValidator implements RequestValidator {
 
         ValidationResult validationResult = new ValidationResult();
 
-        if (input.getEndPoint() == null || input.getEndPoint().isEmpty()) {
+        if(input.getEndPoint() == null || input.getEndPoint().isEmpty()) {
             validationResult.problem("No endpoints specified for a connectivity service");
         } else {
 
@@ -107,11 +112,45 @@ public class DefaultValidator implements RequestValidator {
                     .map(LocalClass::getLocalId)
                     .filter(s -> !allItems.add(s))
                     .findFirst();
-            firstDuplicate.ifPresent(s -> validationResult.problem("A duplicate endpoint id: " + s));
+            firstDuplicate
+                    .ifPresent(s -> validationResult.problem("A duplicate endpoint id: " + s));
+
+            // Validate based on e-tree service
+            if (input.getConnConstraint().getServiceType()
+                    .equals(ServiceType.ROOTEDMULTIPOINTCONNECTIVITY)) {
+
+                List<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev180307.create.connectivity.service.input.EndPoint> getRoles =
+                        input.getEndPoint().stream().filter(e -> e.getRole() != null)
+                                .collect(Collectors.toCollection(
+                                        () -> new ArrayList<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev180307.create.connectivity.service.input.EndPoint>()));
+                Optional<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev180307.create.connectivity.service.input.EndPoint> isRootAvailable =
+                        null;
+
+                if (getRoles.size() >= 2) {
+
+                    isRootAvailable = getRoles.stream().filter(e -> e != null)
+                            .filter(e -> !e.getRole().equals(PortRole.LEAF)
+                                    && !e.getRole().equals(PortRole.ROOT))
+                            .findFirst();
+
+                    long i = getRoles.stream().filter(node -> node.getRole().equals(PortRole.ROOT))
+                            .count();
+
+                    if (isRootAvailable.isPresent()) {
+                        validationResult.problem(
+                                "Invalid request: Only root and leaf nodes are allowed for E-Tree. ");
+                    } else if (i == 0) {
+                        validationResult.problem(
+                                "Invalid request: Atleast one root is required for E-Tree. ");
+                    }
+                } else {
+                    isRootAvailable = getRoles.stream().findFirst();
+                    isRootAvailable.ifPresent(s -> validationResult.problem(
+                            "Invalid request: Atleast two nodes are required "));
+                }
+            }
         }
-
-
-
         return validationResult;
     }
+
 }
index 6e5a5e66b99bcbf9cd7544b2d1b557aaf055c89e..88e783fef157bcd096fcc420ae95602348a514fc 100644 (file)
@@ -9,6 +9,7 @@
 package org.opendaylight.unimgr.mef.nrp.impl.connectivityservice;
 
 import java.text.MessageFormat;
+import java.util.Arrays;
 import java.util.Collections;
 import java.util.LinkedList;
 import java.util.List;
@@ -46,9 +47,12 @@ import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev18030
 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev180307.CreateConnectivityServiceInput;
 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev180307.CreateConnectivityServiceOutput;
 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev180307.CreateConnectivityServiceOutputBuilder;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev180307.ServiceType;
 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev180307.cep.list.ConnectionEndPointBuilder;
 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev180307.connection.ConnectionEndPoint;
 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev180307.connection.RouteBuilder;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev180307.connection.end.point.ParentNodeEdgePoint;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev180307.connection.end.point.ParentNodeEdgePointBuilder;
 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev180307.connectivity.context.Connection;
 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev180307.connectivity.context.ConnectionBuilder;
 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev180307.connectivity.context.ConnectionKey;
@@ -114,7 +118,7 @@ class CreateConnectivityAction implements Callable<RpcResult<CreateConnectivityS
             String uniqueStamp = service.getServiceIdPool().getServiceId();
             LOG.debug("connectivity service passed validation, request = {}", input);
 
-            ActivationTransaction tx = prepareTransaction(toCsId(uniqueStamp));
+            ActivationTransaction tx = prepareTransaction(toCsId(uniqueStamp), input.getConnConstraint().isIsExclusive(), input.getConnConstraint().getServiceType());
             if (tx != null) {
                 ActivationTransaction.Result txResult = tx.activate();
                 if (txResult.isSuccessful()) {
@@ -142,7 +146,7 @@ class CreateConnectivityAction implements Callable<RpcResult<CreateConnectivityS
         }
     }
 
-    private ActivationTransaction prepareTransaction(String serviceId) throws FailureResult {
+    private ActivationTransaction prepareTransaction(String serviceId, boolean isExclusive, ServiceType serviceType) throws FailureResult {
         LOG.debug("decompose request");
         decomposedRequest = service.getDecomposer().decompose(endpoints, null);
 
@@ -162,7 +166,7 @@ class CreateConnectivityAction implements Callable<RpcResult<CreateConnectivityS
                 throw new IllegalStateException(MessageFormat
                         .format("driver {} cannot be created", s.getNodeUuid()));
             }
-            driver.get().initialize(s.getEndpoints(), serviceId, null);
+            driver.get().initialize(s.getEndpoints(), serviceId, null, isExclusive, serviceType);
             LOG.debug("driver {} added to activation transaction", driver.get());
             return driver.get();
         }).forEach(tx::addDriver);
@@ -195,7 +199,7 @@ class CreateConnectivityAction implements Callable<RpcResult<CreateConnectivityS
                 .setLayerProtocolName(LayerProtocolName.ETH)
 
                 .setConnectionEndPoint(
-                        createSystemConnectionPoints(nrpDao, TapiUtils
+                        createConnectionPoints(nrpDao, TapiUtils
                                 .toNodeRef(s.getNodeUuid()), s.getEndpoints(), uniqueStamp))
                 .build())
             .collect(Collectors.toList());
@@ -207,7 +211,7 @@ class CreateConnectivityAction implements Callable<RpcResult<CreateConnectivityS
                 .setLayerProtocolName(LayerProtocolName.ETH)
 //                .setContainerNode(new Uuid(TapiConstants.PRESTO_ABSTRACT_NODE))
                 .setConnectionEndPoint(
-                        createSystemConnectionPoints(nrpDao, TapiUtils
+                        createConnectionPoints(nrpDao, TapiUtils
                                 .toNodeRef(new Uuid(TapiConstants.PRESTO_ABSTRACT_NODE)), endpoints, uniqueStamp))
                 .setRoute(Collections.singletonList(new RouteBuilder()
                         .setLocalId("route")
@@ -267,7 +271,7 @@ class CreateConnectivityAction implements Callable<RpcResult<CreateConnectivityS
                 .setServiceInterfacePoint(ep.getEndpoint().getServiceInterfacePoint())
                 .setDirection(PortDirection.BIDIRECTIONAL)
                 .setLayerProtocolName(LayerProtocolName.ETH)
-                .setRole(PortRole.SYMMETRIC)
+                .setRole(ep.getEndpoint().getRole())
                 .addAugmentation(EndPoint1.class, new EndPoint1Builder(ep.getAttrs()).build())
                 .build();
 
@@ -286,13 +290,13 @@ class CreateConnectivityAction implements Callable<RpcResult<CreateConnectivityS
                 .setOperationalState(csep.getOperationalState())
                 .setLayerProtocolName(csep.getLayerProtocolName())
                 .setLifecycleState(csep.getLifecycleState())
-                .setConnectionPortRole(PortRole.SYMMETRIC)
+                .setConnectionPortRole(csep.getRole())
                 .setConnectionPortDirection(csep.getDirection());
         return builder;
     }
 
-    private List<ConnectionEndPoint> createSystemConnectionPoints(NrpDao nrpDao, NodeRef ref,
-                                                                  List<EndPoint> eps, String uniqueStamp) {
+    private List<ConnectionEndPoint> createConnectionPoints(NrpDao nrpDao, NodeRef ref,
+                                                            List<EndPoint> eps, String uniqueStamp) {
 
         Optional<ConnectivityServiceEndPoint> defaultCsEp = eps.stream()
                 .filter(ep -> ep.getEndpoint() != null).map(EndPoint::getEndpoint).findFirst();
@@ -325,10 +329,14 @@ class CreateConnectivityAction implements Callable<RpcResult<CreateConnectivityS
         List<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev180307
                 .connection.ConnectionEndPoint> ceps = new LinkedList<>();
 
+        ParentNodeEdgePointBuilder pBuilder = new ParentNodeEdgePointBuilder(ref);
+
         for (EndPoint ep : eps) {
             ConnectionEndPointBuilder builder = new ConnectionEndPointBuilder(defaultVal);
             ConnectivityServiceEndPoint csp = ep.getEndpoint();
             OwnedNodeEdgePointRef nepRef = ep.getNepRef();
+            ParentNodeEdgePoint parentRef = pBuilder.setOwnedNodeEdgePointId(nepRef.getOwnedNodeEdgePointId()).build();
+            builder.setParentNodeEdgePoint(Arrays.asList(parentRef));
             cepRefBuilder.setOwnedNodeEdgePointId(nepRef.getOwnedNodeEdgePointId());
             cepRefBuilder.setConnectionEndPointId(new Uuid("cep:"
                     + nepRef.getOwnedNodeEdgePointId().getValue() + ":" + uniqueStamp));
index c12fb3a2aa9fa0ac943f2bdbf236d81bfd1c3a7e..85f9b457e872428534e6c0598a1140e621a6ee5e 100644 (file)
@@ -32,6 +32,7 @@ import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev18030
 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev180307.DeleteConnectivityServiceInput;
 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev180307.DeleteConnectivityServiceOutput;
 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev180307.DeleteConnectivityServiceOutputBuilder;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev180307.ServiceType;
 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev180307.connection.Route;
 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev180307.connectivity.context.Connection;
 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev180307.connectivity.context.ConnectivityService;
@@ -99,7 +100,7 @@ public class DeleteConnectivityAction implements Callable<RpcResult<DeleteConnec
         Service response = new ServiceBuilder(cs).build();
 
         try {
-            ActivationTransaction tx = prepareTransaction(data,nrpDao);
+            ActivationTransaction tx = prepareTransaction(data, nrpDao, cs.getServiceType());
 
             if (tx != null) {
                 ActivationTransaction.Result txResult = tx.deactivate();
@@ -141,7 +142,7 @@ public class DeleteConnectivityAction implements Callable<RpcResult<DeleteConnec
         tx.commit().get();
     }
 
-    private ActivationTransaction prepareTransaction(Map<Uuid, LinkedList<EndPoint>> data, NrpDao nrpDao) {
+    private ActivationTransaction prepareTransaction(Map<Uuid, LinkedList<EndPoint>> data, NrpDao nrpDao, ServiceType serviceType) {
         assert data != null;
         ActivationTransaction tx = new ActivationTransaction();
         data.entrySet().stream().map(e -> {
@@ -155,7 +156,7 @@ public class DeleteConnectivityAction implements Callable<RpcResult<DeleteConnec
                 throw new IllegalStateException(MessageFormat
                         .format("driver {} cannot be created", e.getKey()));
             }
-            driver.get().initialize(e.getValue(), serviceId.getValue(), null);
+            driver.get().initialize(e.getValue(), serviceId.getValue(), null, false, serviceType);
             LOG.debug("driver {} added to deactivation transaction", driver.get());
             return driver.get();
         }).forEach(tx::addDriver);
index 4975714634d19039c4bf6ec72529768345ad6be3..c2a74746791b6ecbe9890ab809c50a7e348cf371 100644 (file)
@@ -128,7 +128,7 @@ public class UpdateConnectivityAction implements Callable<RpcResult<UpdateConnec
 
                     endpoint.setNepRef(ownedNodeEdgePointRef);
 
-                    driver.get().initialize(Collections.singletonList(endpoint), serviceId, null);
+                    driver.get().initialize(Collections.singletonList(endpoint), serviceId, null, true, null);
                     tx.addDriver(driver.get());
                 } else {
                     LOG.warn("No driver information for node {}", node.getUuid());
index 07dad076a5a2d6120e0b1746f3070fca06061124..65954ef9a6a1382a300f71832f4af7e4b00e97b8 100644 (file)
@@ -8,8 +8,8 @@
 
 package org.opendaylight.unimgr.utils;
 
-import com.google.common.base.Optional;
 
+import java.util.Optional;
 import java.util.function.BiFunction;
 
 import org.opendaylight.mdsal.binding.api.DataBroker;
index 20b5d637f65ac90061642a8d957b8daf80583d61..d7834141969386d127efee8d417a3b23408ccbba 100644 (file)
@@ -44,8 +44,10 @@ import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev180307.Uuid
 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev180307.CreateConnectivityServiceInput;
 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev180307.CreateConnectivityServiceInputBuilder;
 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev180307.CreateConnectivityServiceOutput;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev180307.ServiceType;
 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev180307.UpdateConnectivityServiceInput;
 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev180307.connectivity.service.end.point.ServiceInterfacePointBuilder;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev180307.create.connectivity.service.input.ConnConstraintBuilder;
 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev180307.create.connectivity.service.input.EndPoint;
 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev180307.create.connectivity.service.input.EndPointBuilder;
 import org.opendaylight.yangtools.yang.common.RpcResult;
@@ -196,6 +198,8 @@ public class TapiConnectivityServiceImplTest {
 
         return new CreateConnectivityServiceInputBuilder()
                 .setEndPoint(eps)
+                .setConnConstraint(new ConnConstraintBuilder().setIsExclusive(true)
+                .setServiceType(ServiceType.POINTTOPOINTCONNECTIVITY).build())
                 .build();
     }
 
index 5adb0bc15a24821b652f50ca957226748d1bc553..9a3d8e990adf96f5bbe8470604df014c27d6145a 100644 (file)
@@ -85,6 +85,7 @@ import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev18030
 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev180307.GetConnectivityServiceListInputBuilder;
 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev180307.GetConnectivityServiceListOutput;
 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev180307.OwnedNodeEdgePoint1;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev180307.ServiceType;
 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev180307.UpdateConnectivityServiceInput;
 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev180307.connection.ConnectionEndPoint;
 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev180307.connectivity.context.Connection;
@@ -92,6 +93,7 @@ import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev18030
 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev180307.connectivity.context.ConnectivityServiceBuilder;
 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev180307.connectivity.context.ConnectivityServiceKey;
 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev180307.connectivity.service.end.point.ServiceInterfacePoint;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev180307.create.connectivity.service.input.ConnConstraintBuilder;
 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev180307.create.connectivity.service.input.EndPoint;
 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev180307.create.connectivity.service.input.EndPointBuilder;
 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev180307.topology.Node;
@@ -154,6 +156,9 @@ public class TapiConnectivityServiceInplIntTest extends AbstractTestWithTopo {
         //when
         CreateConnectivityServiceInput input = new CreateConnectivityServiceInputBuilder()
                 .setEndPoint(eps(uuid1 + ":1", uuid1 + ":2"))
+                .setConnConstraint(new ConnConstraintBuilder()
+                .setIsExclusive(true)
+                .setServiceType(ServiceType.POINTTOPOINTCONNECTIVITY).build())
                 .build();
 
         RpcResult<CreateConnectivityServiceOutput> result = this.connectivityService
@@ -251,8 +256,12 @@ public class TapiConnectivityServiceInplIntTest extends AbstractTestWithTopo {
         tx.commit().get();
 
         //when
+
         CreateConnectivityServiceInput input = new CreateConnectivityServiceInputBuilder()
                 .setEndPoint(eps(uuid1 + ":1", uuid3 + ":3"))
+                .setConnConstraint(new ConnConstraintBuilder()
+                .setIsExclusive(true)
+                .setServiceType(ServiceType.POINTTOPOINTCONNECTIVITY).build())
                 .build();
 
         RpcResult<CreateConnectivityServiceOutput> result = this.connectivityService
@@ -272,8 +281,14 @@ public class TapiConnectivityServiceInplIntTest extends AbstractTestWithTopo {
         connCtx.getConnection().forEach(this::verifyConnection);
 
         assertEquals(1, connCtx.getConnectivityService().size());
-        assertFalse(connCtx.getConnectivityService().get(0).getEndPoint().isEmpty());
-        assertEquals("cs:" + servId, connCtx.getConnectivityService().get(0).getUuid().getValue());
+        ConnectivityService connectivityService = connCtx.getConnectivityService().get(0);
+
+        List<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev180307.connectivity.service.EndPoint>
+                eps = connectivityService.getEndPoint();
+
+        assertFalse(eps.isEmpty());
+
+        assertEquals("cs:" + servId, connectivityService.getUuid().getValue());
 
     }
 
@@ -574,6 +589,8 @@ public class TapiConnectivityServiceInplIntTest extends AbstractTestWithTopo {
                     ReadWriteTransaction tx, String csId, Connection connection) {
         ConnectivityService cs = new ConnectivityServiceBuilder()
                 .setUuid(new Uuid(csId))
+                .setIsExclusive(true)
+                .setServiceType(ServiceType.POINTTOPOINTCONNECTIVITY)
                 .setConnection(Collections.singletonList(connection.getUuid()))
                 .setEndPoint(toEps(connection.getConnectionEndPoint()))
                 .build();
index 1dd9dd9484462867ae6ae5a64b69e34ad53b826a..10178f9bcca8b499a58287b721977c41a8cd709e 100644 (file)
@@ -21,4 +21,4 @@
   
   <logger name="org.opendaylight.yangtools" level="INFO"/>
   <logger name="org.opendaylight.mdsal" level="INFO"/>
-</configuration>
\ No newline at end of file
+</configuration>
index 0a0c3da9f7beb7d26f0963b349ba4be39869ef97..67cdc29fe852a17564a137c64ed72f79d4db9e67 100644 (file)
@@ -27,7 +27,7 @@
 
     <properties>
         <controller.model.version>1.9.1</controller.model.version>
-        <powermock.version>2.0.0-beta.5</powermock.version>
+        <powermock.version>2.0.2</powermock.version>
     </properties>
 
     <dependencies>
             <artifactId>junit</artifactId>
             <scope>test</scope>
         </dependency>
-        <dependency>
-            <groupId>org.mockito</groupId>
-            <artifactId>mockito-core</artifactId>
-            <version>2.10.0</version>
-            <scope>test</scope>
-        </dependency>
         <dependency>
             <groupId>org.powermock</groupId>
             <artifactId>powermock-core</artifactId>
diff --git a/legato-api/src/main/java/org/opendaylight/unimgr/mef/legato/LegatoBwpProfileController.java b/legato-api/src/main/java/org/opendaylight/unimgr/mef/legato/LegatoBwpProfileController.java
deleted file mode 100644 (file)
index 4604f32..0000000
+++ /dev/null
@@ -1,142 +0,0 @@
-/*
- * Copyright (c) 2018 Xoriant Corporation and others. All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-
-package org.opendaylight.unimgr.mef.legato;
-
-
-import java.util.Collections;
-import java.util.Optional;
-
-import org.opendaylight.mdsal.binding.api.DataBroker;
-import org.opendaylight.mdsal.binding.api.DataTreeIdentifier;
-import org.opendaylight.mdsal.binding.api.DataTreeModification;
-import org.opendaylight.mdsal.common.api.LogicalDatastoreType;
-import org.opendaylight.unimgr.api.UnimgrDataTreeChangeListener;
-import org.opendaylight.unimgr.mef.legato.util.LegatoConstants;
-import org.opendaylight.unimgr.mef.legato.util.LegatoUtils;
-import org.opendaylight.yang.gen.v1.urn.mef.yang.mef.global.rev171215.MefGlobal;
-import org.opendaylight.yang.gen.v1.urn.mef.yang.mef.global.rev171215.mef.global.BwpFlowParameterProfiles;
-import org.opendaylight.yang.gen.v1.urn.mef.yang.mef.global.rev171215.mef.global.BwpFlowParameterProfilesBuilder;
-import org.opendaylight.yang.gen.v1.urn.mef.yang.mef.global.rev171215.mef.global.bwp.flow.parameter.profiles.Profile;
-import org.opendaylight.yang.gen.v1.urn.mef.yang.mef.global.rev171215.mef.global.bwp.flow.parameter.profiles.ProfileKey;
-import org.opendaylight.yangtools.concepts.ListenerRegistration;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-
-/**
- * @author sanket.shirode@Xoriant.com
- */
-public class LegatoBwpProfileController extends UnimgrDataTreeChangeListener<Profile> {
-
-    public LegatoBwpProfileController(DataBroker dataBroker) {
-        super(dataBroker);
-        registerListener();
-    }
-
-    private static final Logger LOG = LoggerFactory.getLogger(LegatoBwpProfileController.class);
-    private static final InstanceIdentifier<Profile> BWP_PROFILE_IID = InstanceIdentifier.builder(MefGlobal.class)
-            .child(BwpFlowParameterProfiles.class).child(Profile.class).build();
-    private ListenerRegistration<LegatoBwpProfileController> dataTreeChangeListenerRegistration;
-
-    private void registerListener() {
-        LOG.info("Initializing LegatoSlsProfileController:init() ");
-        dataTreeChangeListenerRegistration =
-                dataBroker.registerDataTreeChangeListener(DataTreeIdentifier.create(
-                        LogicalDatastoreType.CONFIGURATION, BWP_PROFILE_IID), this);
-
-    }
-
-    @Override
-    public void close() throws Exception {
-        if (dataTreeChangeListenerRegistration != null) {
-            dataTreeChangeListenerRegistration.close();
-        }
-    }
-
-    @Override
-    public void add(DataTreeModification<Profile> newDataObject) {
-        LOG.info("  Node Added  " + newDataObject.getRootNode().getIdentifier());
-        addToOperationalDB(newDataObject.getRootNode().getDataAfter());
-    }
-
-    public void addToOperationalDB(Profile profile) {
-        try {
-            assert profile != null;
-            BwpFlowParameterProfiles bwpProfiles = new BwpFlowParameterProfilesBuilder()
-                    .setProfile(Collections.singletonList(profile)).build();
-            InstanceIdentifier<BwpFlowParameterProfiles> profilesTx = InstanceIdentifier
-                    .create(MefGlobal.class).child(BwpFlowParameterProfiles.class);
-            LegatoUtils.addToOperationalDB(bwpProfiles, profilesTx, dataBroker);
-        } catch (Exception ex) {
-            LOG.error("error: ", ex);
-        }
-    }
-
-    @Override
-    public void remove(DataTreeModification<Profile> removedDataObject) {
-        if (removedDataObject.getRootNode() != null && removedDataObject.getRootPath() != null) {
-            LOG.info("  Node removed  " + removedDataObject.getRootNode().getIdentifier());
-            try {
-                assert removedDataObject.getRootNode().getDataBefore() != null;
-                deleteFromOperationalDB(removedDataObject.getRootNode().getDataBefore());
-            } catch (Exception ex) {
-                LOG.error("error: ", ex);
-            }
-        }
-    }
-
-    public void deleteFromOperationalDB(Profile profile) {
-        try {
-            assert profile != null;
-            LegatoUtils.deleteFromOperationalDB(
-                    InstanceIdentifier.create(MefGlobal.class).child(BwpFlowParameterProfiles.class)
-                            .child(Profile.class, new ProfileKey(profile.getId())),
-                    dataBroker);
-
-        } catch (Exception ex) {
-            LOG.error("error: ", ex);
-        }
-    }
-
-
-    @Override
-    public void update(DataTreeModification<Profile> modifiedDataObject) {
-        // TODO Auto-generated method stub
-
-        if (modifiedDataObject.getRootNode() != null && modifiedDataObject.getRootPath() != null) {
-            LOG.info("  Node modified  " + modifiedDataObject.getRootNode().getIdentifier());
-
-            try {
-                assert modifiedDataObject.getRootNode().getDataAfter() != null;
-                updateFromOperationalDB(modifiedDataObject.getRootNode().getDataAfter());
-            } catch (Exception ex) {
-                LOG.error("error: ", ex);
-            }
-        }
-    }
-
-
-    @SuppressWarnings("unchecked")
-    public void updateFromOperationalDB(Profile profile) {
-        assert profile != null;
-        InstanceIdentifier<Profile> instanceIdentifier =
-                InstanceIdentifier.create(MefGlobal.class).child(BwpFlowParameterProfiles.class)
-                        .child(Profile.class, new ProfileKey(profile.getId()));
-        Optional<Profile> optionalProfile =
-                (Optional<Profile>) LegatoUtils.readProfile(LegatoConstants.BWP_PROFILES,
-                        dataBroker, LogicalDatastoreType.CONFIGURATION, instanceIdentifier);
-        if (optionalProfile.isPresent()) {
-            LegatoUtils.deleteFromOperationalDB(instanceIdentifier, dataBroker);
-            addToOperationalDB(optionalProfile.get());
-        }
-
-    }
-
-}
diff --git a/legato-api/src/main/java/org/opendaylight/unimgr/mef/legato/LegatoColorMappingProfileController.java b/legato-api/src/main/java/org/opendaylight/unimgr/mef/legato/LegatoColorMappingProfileController.java
deleted file mode 100644 (file)
index b607465..0000000
+++ /dev/null
@@ -1,139 +0,0 @@
-/*
- * Copyright (c) 2018 Xoriant Corporation and others. All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-
-package org.opendaylight.unimgr.mef.legato;
-
-import java.util.Collections;
-import java.util.Optional;
-
-import org.opendaylight.mdsal.binding.api.DataBroker;
-import org.opendaylight.mdsal.binding.api.DataTreeIdentifier;
-import org.opendaylight.mdsal.binding.api.DataTreeModification;
-import org.opendaylight.mdsal.common.api.LogicalDatastoreType;
-import org.opendaylight.unimgr.api.UnimgrDataTreeChangeListener;
-import org.opendaylight.unimgr.mef.legato.util.LegatoConstants;
-import org.opendaylight.unimgr.mef.legato.util.LegatoUtils;
-import org.opendaylight.yang.gen.v1.urn.mef.yang.mef.global.rev171215.MefGlobal;
-import org.opendaylight.yang.gen.v1.urn.mef.yang.mef.global.rev171215.mef.global.ColorMappingProfiles;
-import org.opendaylight.yang.gen.v1.urn.mef.yang.mef.global.rev171215.mef.global.ColorMappingProfilesBuilder;
-import org.opendaylight.yang.gen.v1.urn.mef.yang.mef.global.rev171215.mef.global.color.mapping.profiles.Profile;
-import org.opendaylight.yang.gen.v1.urn.mef.yang.mef.global.rev171215.mef.global.color.mapping.profiles.ProfileKey;
-import org.opendaylight.yangtools.concepts.ListenerRegistration;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-
-/**
- * @author sanket.shirode@Xoriant.com
- */
-
-public class LegatoColorMappingProfileController extends UnimgrDataTreeChangeListener<Profile> {
-
-    private static final Logger LOG = LoggerFactory.getLogger(LegatoColorMappingProfileController.class);
-    private ListenerRegistration<LegatoColorMappingProfileController> dataTreeChangeListenerRegistration;
-    private static final InstanceIdentifier<Profile> CMP_PROFILE_IID = InstanceIdentifier.builder(MefGlobal.class)
-            .child(ColorMappingProfiles.class).child(Profile.class).build();
-
-    public LegatoColorMappingProfileController(DataBroker dataBroker) {
-        super(dataBroker);
-        registerListener();
-    }
-
-    private void registerListener() {
-        LOG.info("Initializing LegatoSlsProfileController:init() ");
-
-        dataTreeChangeListenerRegistration = dataBroker.registerDataTreeChangeListener(
-                DataTreeIdentifier.create(LogicalDatastoreType.CONFIGURATION, CMP_PROFILE_IID), this);
-
-    }
-
-    @Override
-    public void close() throws Exception {
-        if (dataTreeChangeListenerRegistration != null) {
-            dataTreeChangeListenerRegistration.close();
-        }
-    }
-
-    @Override
-    public void add(DataTreeModification<Profile> newDataObject) {
-        LOG.info("  Node Added  " + newDataObject.getRootNode().getIdentifier());
-        addToOperationalDB(newDataObject.getRootNode().getDataAfter());
-    }
-
-    public void addToOperationalDB(Profile profile) {
-        try {
-            assert profile != null;
-            ColorMappingProfiles colorMappingProfiles = new ColorMappingProfilesBuilder()
-                    .setProfile(Collections.singletonList(profile)).build();
-            InstanceIdentifier<ColorMappingProfiles> profilesTx = InstanceIdentifier.create(MefGlobal.class)
-                .child(ColorMappingProfiles.class);
-            LegatoUtils.addToOperationalDB(colorMappingProfiles, profilesTx, dataBroker);
-        } catch (Exception ex) {
-            LOG.error("error: ", ex);
-        }
-    }
-
-
-    @Override
-    public void remove(DataTreeModification<Profile> removedDataObject) {
-        if (removedDataObject.getRootNode() != null && removedDataObject.getRootPath() != null) {
-            LOG.info("  Node removed  " + removedDataObject.getRootNode().getIdentifier());
-            try {
-                assert removedDataObject.getRootNode().getDataBefore() != null;
-                deleteFromOperationalDB(removedDataObject.getRootNode().getDataBefore());
-            } catch (Exception ex) {
-                LOG.error("error: ", ex);
-            }
-        }
-    }
-
-
-    public void deleteFromOperationalDB(Profile profile) {
-        try {
-            assert profile != null;
-            LegatoUtils.deleteFromOperationalDB(
-                    InstanceIdentifier.create(MefGlobal.class).child(ColorMappingProfiles.class)
-                            .child(Profile.class, new ProfileKey(profile.getId())),
-                    dataBroker);
-        } catch (Exception ex) {
-            LOG.error("error: ", ex);
-        }
-    }
-
-
-    @Override
-    public void update(DataTreeModification<Profile> modifiedDataObject) {
-        if (modifiedDataObject.getRootNode() != null && modifiedDataObject.getRootPath() != null) {
-            LOG.info("  Node modified  " + modifiedDataObject.getRootNode().getIdentifier());
-            try {
-                assert modifiedDataObject.getRootNode().getDataAfter() != null;
-                updateFromOperationalDB(modifiedDataObject.getRootNode().getDataAfter());
-            } catch (Exception ex) {
-                LOG.error("error: ", ex);
-            }
-        }
-    }
-
-
-    @SuppressWarnings("unchecked")
-    public void updateFromOperationalDB(Profile profile) {
-        assert profile != null;
-        InstanceIdentifier<Profile> instanceIdentifier =
-                InstanceIdentifier.create(MefGlobal.class).child(ColorMappingProfiles.class)
-                        .child(Profile.class, new ProfileKey(profile.getId()));
-        Optional<Profile> optionalProfile =
-                (Optional<Profile>) LegatoUtils.readProfile(LegatoConstants.CMP_PROFILES,
-                        dataBroker, LogicalDatastoreType.CONFIGURATION, instanceIdentifier);
-        if (optionalProfile.isPresent()) {
-            LegatoUtils.deleteFromOperationalDB(instanceIdentifier, dataBroker);
-            addToOperationalDB(optionalProfile.get());
-        }
-    }
-
-}
diff --git a/legato-api/src/main/java/org/opendaylight/unimgr/mef/legato/LegatoCosProfileController.java b/legato-api/src/main/java/org/opendaylight/unimgr/mef/legato/LegatoCosProfileController.java
deleted file mode 100644 (file)
index a818625..0000000
+++ /dev/null
@@ -1,128 +0,0 @@
-/*
- * Copyright (c) 2018 Xoriant Corporation and others. All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-
-package org.opendaylight.unimgr.mef.legato;
-
-import java.util.Collections;
-import java.util.Optional;
-
-import org.opendaylight.mdsal.binding.api.DataBroker;
-import org.opendaylight.mdsal.binding.api.DataTreeIdentifier;
-import org.opendaylight.mdsal.binding.api.DataTreeModification;
-import org.opendaylight.mdsal.common.api.LogicalDatastoreType;
-import org.opendaylight.unimgr.api.UnimgrDataTreeChangeListener;
-import org.opendaylight.unimgr.mef.legato.util.LegatoConstants;
-import org.opendaylight.unimgr.mef.legato.util.LegatoUtils;
-import org.opendaylight.yang.gen.v1.urn.mef.yang.mef.global.rev171215.MefGlobal;
-import org.opendaylight.yang.gen.v1.urn.mef.yang.mef.global.rev171215.mef.global.CosProfiles;
-import org.opendaylight.yang.gen.v1.urn.mef.yang.mef.global.rev171215.mef.global.CosProfilesBuilder;
-import org.opendaylight.yang.gen.v1.urn.mef.yang.mef.global.rev171215.mef.global.cos.profiles.Profile;
-import org.opendaylight.yang.gen.v1.urn.mef.yang.mef.global.rev171215.mef.global.cos.profiles.ProfileKey;
-import org.opendaylight.yangtools.concepts.ListenerRegistration;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-
-/**
- * @author Arif.Hussain@Xoriant.Com
- */
-public class LegatoCosProfileController extends UnimgrDataTreeChangeListener<Profile> {
-
-    public LegatoCosProfileController(DataBroker dataBroker) {
-        super(dataBroker);
-        registerListener();
-    }
-
-    private static final Logger LOG = LoggerFactory.getLogger(LegatoCosProfileController.class);
-    private static final InstanceIdentifier<Profile> PROFILE_IID = InstanceIdentifier.builder(MefGlobal.class)
-            .child(CosProfiles.class).child(Profile.class).build();
-    private ListenerRegistration<LegatoCosProfileController> dataTreeChangeListenerRegistration;
-
-    public void registerListener() {
-        LOG.info("Initializing LegatoSlsProfileController:init() ");
-        dataTreeChangeListenerRegistration = dataBroker.registerDataTreeChangeListener(
-                DataTreeIdentifier.create(LogicalDatastoreType.CONFIGURATION, PROFILE_IID), this);
-    }
-
-    @Override
-    public void close() throws Exception {
-        if (dataTreeChangeListenerRegistration != null) {
-            dataTreeChangeListenerRegistration.close();
-        }
-    }
-
-    @Override
-    public void add(DataTreeModification<Profile> newDataObject) {
-        LOG.info("  Node Added  " + newDataObject.getRootNode().getIdentifier());
-        addToOperationalDB(newDataObject.getRootNode().getDataAfter());
-    }
-
-    public void addToOperationalDB(Profile profile) {
-        try {
-            assert profile != null;
-            CosProfiles cosProfiles = new CosProfilesBuilder().setProfile(Collections.singletonList(profile)).build();
-            InstanceIdentifier<CosProfiles> profilesTx = InstanceIdentifier.create(MefGlobal.class)
-                .child(CosProfiles.class);
-            LegatoUtils.addToOperationalDB(cosProfiles, profilesTx, dataBroker);
-        } catch (Exception ex) {
-            LOG.error("error: ", ex);
-        }
-    }
-
-    @Override
-    public void remove(DataTreeModification<Profile> removedDataObject) {
-        // TODO Auto-generated method stub
-        if (removedDataObject.getRootNode() != null && removedDataObject.getRootPath() != null) {
-            LOG.info("  Node removed  " + removedDataObject.getRootNode().getIdentifier());
-            try {
-                assert removedDataObject.getRootNode().getDataBefore() != null;
-                deleteFromOperationalDB(removedDataObject.getRootNode().getDataBefore());
-            } catch (Exception ex) {
-                LOG.error("error: ", ex);
-            }
-        }
-    }
-
-
-    public void deleteFromOperationalDB(Profile profile) {
-        assert profile != null;
-        LegatoUtils.deleteFromOperationalDB(InstanceIdentifier.create(MefGlobal.class)
-                .child(CosProfiles.class).child(Profile.class, new ProfileKey(profile.getId())),
-                dataBroker);
-    }
-
-    @Override
-    public void update(DataTreeModification<Profile> modifiedDataObject) {
-        // TODO Auto-generated method stub
-        if (modifiedDataObject.getRootNode() != null && modifiedDataObject.getRootPath() != null) {
-            LOG.info("  Node modified  " + modifiedDataObject.getRootNode().getIdentifier());
-            try {
-                assert modifiedDataObject.getRootNode().getDataAfter() != null;
-                updateFromOperationalDB(modifiedDataObject.getRootNode().getDataAfter());
-            } catch (Exception ex) {
-                LOG.error("error: ", ex);
-            }
-        }
-    }
-
-    @SuppressWarnings("unchecked")
-    public void updateFromOperationalDB(Profile profile) {
-        assert profile != null;
-        InstanceIdentifier<Profile> instanceIdentifier = InstanceIdentifier.create(MefGlobal.class)
-                .child(CosProfiles.class).child(Profile.class, new ProfileKey(profile.getId()));
-        Optional<Profile> optionalProfile =
-                (Optional<Profile>) LegatoUtils.readProfile(LegatoConstants.COS_PROFILES,
-                        dataBroker, LogicalDatastoreType.CONFIGURATION, instanceIdentifier);
-        if (optionalProfile.isPresent()) {
-            LegatoUtils.deleteFromOperationalDB(instanceIdentifier, dataBroker);
-            addToOperationalDB(optionalProfile.get());
-        }
-    }
-
-}
diff --git a/legato-api/src/main/java/org/opendaylight/unimgr/mef/legato/LegatoEecProfileController.java b/legato-api/src/main/java/org/opendaylight/unimgr/mef/legato/LegatoEecProfileController.java
deleted file mode 100644 (file)
index 1d5004c..0000000
+++ /dev/null
@@ -1,130 +0,0 @@
-/*
- * Copyright (c) 2018 Xoriant Corporation and others. All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-
-package org.opendaylight.unimgr.mef.legato;
-
-import java.util.Collections;
-import java.util.Optional;
-
-import org.opendaylight.mdsal.binding.api.DataBroker;
-import org.opendaylight.mdsal.binding.api.DataTreeIdentifier;
-import org.opendaylight.mdsal.binding.api.DataTreeModification;
-import org.opendaylight.mdsal.common.api.LogicalDatastoreType;
-import org.opendaylight.unimgr.api.UnimgrDataTreeChangeListener;
-import org.opendaylight.unimgr.mef.legato.util.LegatoConstants;
-import org.opendaylight.unimgr.mef.legato.util.LegatoUtils;
-import org.opendaylight.yang.gen.v1.urn.mef.yang.mef.global.rev171215.MefGlobal;
-import org.opendaylight.yang.gen.v1.urn.mef.yang.mef.global.rev171215.mef.global.EecProfiles;
-import org.opendaylight.yang.gen.v1.urn.mef.yang.mef.global.rev171215.mef.global.EecProfilesBuilder;
-import org.opendaylight.yang.gen.v1.urn.mef.yang.mef.global.rev171215.mef.global.eec.profiles.Profile;
-import org.opendaylight.yang.gen.v1.urn.mef.yang.mef.global.rev171215.mef.global.eec.profiles.ProfileKey;
-import org.opendaylight.yangtools.concepts.ListenerRegistration;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-
-/**
- * @author sanket.shirode@Xoriant.com
- */
-
-public class LegatoEecProfileController extends UnimgrDataTreeChangeListener<Profile> {
-
-    private static final Logger LOG = LoggerFactory.getLogger(LegatoEecProfileController.class);
-    private ListenerRegistration<LegatoEecProfileController> dataTreeChangeListenerRegistration;
-    private static final InstanceIdentifier<Profile> EEC_PROFILE_IID = InstanceIdentifier.builder(MefGlobal.class)
-            .child(EecProfiles.class).child(Profile.class).build();
-
-    public LegatoEecProfileController(DataBroker dataBroker) {
-        super(dataBroker);
-        registerListener();
-    }
-
-    private void registerListener() {
-        LOG.info("Initializing LegatoSlsProfileController:init() ");
-
-        dataTreeChangeListenerRegistration = dataBroker.registerDataTreeChangeListener(
-                DataTreeIdentifier.create(LogicalDatastoreType.CONFIGURATION, EEC_PROFILE_IID), this);
-
-    }
-
-    @Override
-    public void close() throws Exception {
-        if (dataTreeChangeListenerRegistration != null) {
-            dataTreeChangeListenerRegistration.close();
-        }
-    }
-
-    @Override
-    public void add(DataTreeModification<Profile> newDataObject) {
-        LOG.info("  Node Added  " + newDataObject.getRootNode().getIdentifier());
-        addToOperationalDB(newDataObject.getRootNode().getDataAfter());
-    }
-
-    public void addToOperationalDB(Profile profile) {
-        try {
-            assert profile != null;
-            EecProfiles eecProfiles = new EecProfilesBuilder().setProfile(Collections.singletonList(profile)).build();
-            InstanceIdentifier<EecProfiles> profilesTx = InstanceIdentifier.create(MefGlobal.class)
-                    .child(EecProfiles.class);
-            LegatoUtils.addToOperationalDB(eecProfiles, profilesTx, dataBroker);
-        } catch (Exception ex) {
-            LOG.error("error: ", ex);
-        }
-    }
-
-    @Override
-    public void remove(DataTreeModification<Profile> removedDataObject) {
-        if (removedDataObject.getRootNode() != null && removedDataObject.getRootPath() != null) {
-            LOG.info("  Node removed  " + removedDataObject.getRootNode().getIdentifier());
-            try {
-                assert removedDataObject.getRootNode().getDataBefore() != null;
-                deleteFromOperationalDB(removedDataObject.getRootNode().getDataBefore());
-            } catch (Exception ex) {
-                LOG.error("error: ", ex);
-            }
-        }
-    }
-
-    public void deleteFromOperationalDB(Profile profile) {
-        assert profile != null;
-        LegatoUtils.deleteFromOperationalDB(
-                InstanceIdentifier.create(MefGlobal.class).child(EecProfiles.class)
-                        .child(Profile.class, new ProfileKey(profile.getId())), dataBroker);
-    }
-
-
-    @Override
-    public void update(DataTreeModification<Profile> modifiedDataObject) {
-        if (modifiedDataObject.getRootNode() != null && modifiedDataObject.getRootPath() != null) {
-            LOG.info("  Node modified  " + modifiedDataObject.getRootNode().getIdentifier());
-            LOG.info(" inside updateNode()");
-            try {
-                assert modifiedDataObject.getRootNode().getDataAfter() != null;
-                updateFromOperationalDB(modifiedDataObject.getRootNode().getDataAfter());
-            } catch (Exception ex) {
-                LOG.error("error: ", ex);
-            }
-        }
-    }
-
-    @SuppressWarnings("unchecked")
-    public void updateFromOperationalDB(Profile profile) {
-        assert profile != null;
-        InstanceIdentifier<Profile> instanceIdentifier = InstanceIdentifier.create(MefGlobal.class)
-                .child(EecProfiles.class).child(Profile.class, new ProfileKey(profile.getId()));
-        Optional<Profile> optionalProfile =
-                (Optional<Profile>) LegatoUtils.readProfile(LegatoConstants.EEC_PROFILES,
-                        dataBroker, LogicalDatastoreType.CONFIGURATION, instanceIdentifier);
-        if (optionalProfile.isPresent()) {
-            LegatoUtils.deleteFromOperationalDB(instanceIdentifier, dataBroker);
-            addToOperationalDB(optionalProfile.get());
-        }
-    }
-
-}
diff --git a/legato-api/src/main/java/org/opendaylight/unimgr/mef/legato/LegatoL2cpEecController.java b/legato-api/src/main/java/org/opendaylight/unimgr/mef/legato/LegatoL2cpEecController.java
deleted file mode 100644 (file)
index 07fe8c1..0000000
+++ /dev/null
@@ -1,157 +0,0 @@
-/*
- * Copyright (c) 2018 Xoriant Corporation and others. All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-
-package org.opendaylight.unimgr.mef.legato;
-
-import java.util.Collections;
-import java.util.Optional;
-
-import org.opendaylight.mdsal.binding.api.DataBroker;
-import org.opendaylight.mdsal.binding.api.DataTreeIdentifier;
-import org.opendaylight.mdsal.binding.api.DataTreeModification;
-import org.opendaylight.mdsal.common.api.LogicalDatastoreType;
-import org.opendaylight.unimgr.api.UnimgrDataTreeChangeListener;
-import org.opendaylight.unimgr.mef.legato.util.LegatoConstants;
-import org.opendaylight.unimgr.mef.legato.util.LegatoUtils;
-import org.opendaylight.yang.gen.v1.urn.mef.yang.mef.global.rev171215.MefGlobal;
-import org.opendaylight.yang.gen.v1.urn.mef.yang.mef.global.rev171215.mef.global.L2cpEecProfiles;
-import org.opendaylight.yang.gen.v1.urn.mef.yang.mef.global.rev171215.mef.global.L2cpEecProfilesBuilder;
-import org.opendaylight.yang.gen.v1.urn.mef.yang.mef.global.rev171215.mef.global.l2cp.eec.profiles.Profile;
-import org.opendaylight.yang.gen.v1.urn.mef.yang.mef.global.rev171215.mef.global.l2cp.eec.profiles.ProfileKey;
-import org.opendaylight.yangtools.concepts.ListenerRegistration;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-
-/**
- * @author Arif.Hussain@Xoriant.Com
- *
- */
-public class LegatoL2cpEecController  extends UnimgrDataTreeChangeListener<Profile> {
-
-    private static final Logger LOG = LoggerFactory.getLogger(LegatoL2cpEecController.class);
-
-    private static final InstanceIdentifier<Profile> PROFILE_ID = InstanceIdentifier
-            .builder(MefGlobal.class).child(L2cpEecProfiles.class).child(Profile.class).build();
-
-    private static final InstanceIdentifier<L2cpEecProfiles> L2CP_EEC_PROFILES_ID_OPERATIONAL = InstanceIdentifier
-            .builder(MefGlobal.class).child(L2cpEecProfiles.class).build();
-
-    private ListenerRegistration<LegatoL2cpEecController> dataTreeChangeListenerRegistration;
-
-    public LegatoL2cpEecController(DataBroker dataBroker) {
-        super(dataBroker);
-        registerListener();
-    }
-
-    public void registerListener() {
-        LOG.info("Initializing LegatoL2cpEecController:init() ");
-
-        dataTreeChangeListenerRegistration = dataBroker.registerDataTreeChangeListener(
-                DataTreeIdentifier.create(LogicalDatastoreType.CONFIGURATION, PROFILE_ID), this);
-    }
-
-    @Override
-    public void add(DataTreeModification<Profile> newDataObject) {
-        LOG.info("ClassName :: LegatoL2cpEecController, Method:: add(), Message:: Node Added  "
-                + newDataObject.getRootNode().getIdentifier());
-        addToOperationalDB(newDataObject.getRootNode().getDataAfter());
-    }
-
-    public void addToOperationalDB(Profile profileObj) {
-
-        LOG.info(" inside addNode()");
-
-        try {
-            assert profileObj != null;
-
-            L2cpEecProfiles l2cpEecProfiles = new L2cpEecProfilesBuilder()
-                    .setProfile(Collections.singletonList(profileObj)).build();
-            LegatoUtils.addToOperationalDB(l2cpEecProfiles, L2CP_EEC_PROFILES_ID_OPERATIONAL,
-                    dataBroker);
-        } catch (Exception e) {
-            LOG.error("Error in addNode(). Err: ", e);
-        }
-        LOG.info(" ********** END addNode() ****************** ");
-    }
-
-
-    @Override
-    public void update(DataTreeModification<Profile> modifiedDataObject) {
-        if (modifiedDataObject.getRootNode() != null && modifiedDataObject.getRootPath() != null) {
-            LOG.info("ClassName :: LegatoL2cpEecController, Method:: update(), Message:: Node modified "
-                    + modifiedDataObject.getRootNode().getIdentifier());
-
-            try {
-                assert modifiedDataObject.getRootNode().getDataAfter() != null;
-                updateFromOperationalDB(modifiedDataObject.getRootNode().getDataAfter());
-            } catch (Exception ex) {
-                LOG.error("error: ", ex);
-            }
-        }
-    }
-
-    @SuppressWarnings("unchecked")
-    public void updateFromOperationalDB(Profile profile) {
-        assert profile != null;
-        Optional<Profile> optionalProfile =
-                (Optional<Profile>) LegatoUtils.readProfile(LegatoConstants.L2CP_EEC_PROFILES,
-                        dataBroker, LogicalDatastoreType.CONFIGURATION,
-                        InstanceIdentifier.create(MefGlobal.class).child(L2cpEecProfiles.class)
-                                .child(Profile.class, new ProfileKey(profile.getId())));
-
-        if (optionalProfile.isPresent()) {
-
-            LegatoUtils.deleteFromOperationalDB(InstanceIdentifier.create(MefGlobal.class).child(L2cpEecProfiles.class)
-                    .child(Profile.class, new ProfileKey(profile.getId())), dataBroker);
-
-            addToOperationalDB(optionalProfile.get());
-        }
-    }
-
-
-    @Override
-    public void remove(DataTreeModification<Profile> removedDataObject) {
-        if (removedDataObject.getRootNode() != null && removedDataObject.getRootPath() != null) {
-            LOG.info(
-                    "ClassName :: LegatoL2cpEecController, Method:: remove(), Message:: Node removed  "
-                            + removedDataObject.getRootNode().getIdentifier());
-
-            try {
-                assert removedDataObject.getRootNode().getDataBefore() != null;
-                deleteFromOperationalDB(removedDataObject.getRootNode().getDataBefore());
-            } catch (Exception ex) {
-                LOG.error("error: ", ex);
-            }
-        }
-    }
-
-
-    public void deleteFromOperationalDB(Profile profile) {
-        try {
-            assert profile != null;
-            LegatoUtils
-                    .deleteFromOperationalDB(
-                            InstanceIdentifier.create(MefGlobal.class).child(L2cpEecProfiles.class)
-                                    .child(Profile.class, new ProfileKey(profile.getId())),
-                            dataBroker);
-        } catch (Exception ex) {
-            LOG.error("error: ", ex);
-        }
-    }
-
-    @Override
-    public void close() throws Exception {
-        if (dataTreeChangeListenerRegistration != null) {
-            dataTreeChangeListenerRegistration.close();
-        }
-    }
-
-
-}
diff --git a/legato-api/src/main/java/org/opendaylight/unimgr/mef/legato/LegatoL2cpPeeringController.java b/legato-api/src/main/java/org/opendaylight/unimgr/mef/legato/LegatoL2cpPeeringController.java
deleted file mode 100644 (file)
index e645592..0000000
+++ /dev/null
@@ -1,159 +0,0 @@
-/*
- * Copyright (c) 2018 Xoriant Corporation and others. All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-
-package org.opendaylight.unimgr.mef.legato;
-
-import java.util.Collections;
-import java.util.Optional;
-
-import org.opendaylight.mdsal.binding.api.DataBroker;
-import org.opendaylight.mdsal.binding.api.DataTreeIdentifier;
-import org.opendaylight.mdsal.binding.api.DataTreeModification;
-import org.opendaylight.mdsal.common.api.LogicalDatastoreType;
-import org.opendaylight.unimgr.api.UnimgrDataTreeChangeListener;
-import org.opendaylight.unimgr.mef.legato.util.LegatoConstants;
-import org.opendaylight.unimgr.mef.legato.util.LegatoUtils;
-import org.opendaylight.yang.gen.v1.urn.mef.yang.mef.global.rev171215.MefGlobal;
-import org.opendaylight.yang.gen.v1.urn.mef.yang.mef.global.rev171215.mef.global.L2cpPeeringProfiles;
-import org.opendaylight.yang.gen.v1.urn.mef.yang.mef.global.rev171215.mef.global.L2cpPeeringProfilesBuilder;
-import org.opendaylight.yang.gen.v1.urn.mef.yang.mef.global.rev171215.mef.global.l2cp.peering.profiles.Profile;
-import org.opendaylight.yang.gen.v1.urn.mef.yang.mef.global.rev171215.mef.global.l2cp.peering.profiles.ProfileKey;
-import org.opendaylight.yangtools.concepts.ListenerRegistration;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-
-/**
- * @author Arif.Hussain@Xoriant.Com
- *
- */
-public class LegatoL2cpPeeringController extends UnimgrDataTreeChangeListener<Profile> {
-
-    private static final Logger LOG = LoggerFactory.getLogger(LegatoL2cpPeeringController.class);
-
-    private static final InstanceIdentifier<Profile> PROFILE_ID = InstanceIdentifier
-            .builder(MefGlobal.class).child(L2cpPeeringProfiles.class).child(Profile.class).build();
-
-    private static final InstanceIdentifier<L2cpPeeringProfiles> L2CP_PEERING_PROFILES_ID_OPERATIONAL =
-            InstanceIdentifier.builder(MefGlobal.class).child(L2cpPeeringProfiles.class).build();
-
-    private ListenerRegistration<LegatoL2cpPeeringController> dataTreeChangeListenerRegistration;
-
-    public LegatoL2cpPeeringController(DataBroker dataBroker) {
-        super(dataBroker);
-        registerListener();
-    }
-
-    public void registerListener() {
-        LOG.info("Initializing LegatoL2cpPeeringController:init() ");
-
-        dataTreeChangeListenerRegistration = dataBroker.registerDataTreeChangeListener(
-                DataTreeIdentifier.create(LogicalDatastoreType.CONFIGURATION, PROFILE_ID),
-                this);
-    }
-
-
-    @Override
-    public void add(DataTreeModification<Profile> newDataObject) {
-        LOG.info("ClassName :: LegatoL2cpPeeringController, Method:: add(), Message:: Node Added  "
-                + newDataObject.getRootNode().getIdentifier());
-        addToOperationalDB(newDataObject.getRootNode().getDataAfter());
-    }
-
-
-    public void addToOperationalDB(Profile profileObj) {
-
-        LOG.info(" inside addNode()");
-
-        try {
-            assert profileObj != null;
-            L2cpPeeringProfiles l2cpPeeringProfiles = new L2cpPeeringProfilesBuilder()
-                    .setProfile(Collections.singletonList(profileObj)).build();
-            LegatoUtils.addToOperationalDB(l2cpPeeringProfiles, L2CP_PEERING_PROFILES_ID_OPERATIONAL, dataBroker);
-        } catch (Exception e) {
-            LOG.error("Error in addNode(). Err: ", e);
-        }
-        LOG.info(" ********** END addNode() ****************** ");
-
-    }
-
-
-    @Override
-    public void update(DataTreeModification<Profile> modifiedDataObject) {
-        if (modifiedDataObject.getRootNode() != null && modifiedDataObject.getRootPath() != null) {
-            LOG.info(
-                    "ClassName :: LegatoL2cpPeeringController, Method:: update(), Message:: Node modified  "
-                            + modifiedDataObject.getRootNode().getIdentifier());
-
-            try {
-                assert modifiedDataObject.getRootNode().getDataAfter() != null;
-                updateFromOperationalDB(modifiedDataObject.getRootNode().getDataAfter());
-            } catch (Exception ex) {
-                LOG.error("error: ", ex);
-            }
-        }
-    }
-
-    @SuppressWarnings("unchecked")
-    public void updateFromOperationalDB(Profile profile) {
-        assert profile != null;
-        Optional<Profile> optionalProfile =
-                (Optional<Profile>) LegatoUtils.readProfile(LegatoConstants.L2CP_PEERING_PROFILES,
-                        dataBroker, LogicalDatastoreType.CONFIGURATION,
-                        InstanceIdentifier.create(MefGlobal.class).child(L2cpPeeringProfiles.class)
-                                .child(Profile.class, new ProfileKey(profile.getId())));
-
-        if (optionalProfile.isPresent()) {
-
-            LegatoUtils.deleteFromOperationalDB(
-                    InstanceIdentifier.create(MefGlobal.class).child(L2cpPeeringProfiles.class)
-                            .child(Profile.class, new ProfileKey(profile.getId())),
-                    dataBroker);
-
-            addToOperationalDB(optionalProfile.get());
-        }
-
-    }
-
-    @Override
-    public void remove(DataTreeModification<Profile> removedDataObject) {
-        if (removedDataObject.getRootNode() != null && removedDataObject.getRootPath() != null) {
-            LOG.info(
-                    "ClassName :: LegatoL2cpPeeringController, Method:: remove(), Message:: Node removed  "
-                            + removedDataObject.getRootNode().getIdentifier());
-
-            try {
-                assert removedDataObject.getRootNode().getDataBefore() != null;
-                deleteFromOperationalDB(removedDataObject.getRootNode().getDataBefore());
-            } catch (Exception ex) {
-                LOG.error("error: ", ex);
-            }
-        }
-    }
-
-    public void deleteFromOperationalDB(Profile profile) {
-        try {
-            assert profile != null;
-            LegatoUtils.deleteFromOperationalDB(
-                    InstanceIdentifier.create(MefGlobal.class).child(L2cpPeeringProfiles.class)
-                            .child(Profile.class, new ProfileKey(profile.getId())),
-                    dataBroker);
-        } catch (Exception ex) {
-            LOG.error("error: ", ex);
-        }
-    }
-
-    @Override
-    public void close() throws Exception {
-        if (dataTreeChangeListenerRegistration != null) {
-            dataTreeChangeListenerRegistration.close();
-        }
-    }
-
-}
index 4a7351bbdf4d807ee50df9525f312d1711f52aa1..215e3a19c9cc3ddc090256b9e663d43c6760023c 100644 (file)
@@ -5,10 +5,10 @@
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-
 package org.opendaylight.unimgr.mef.legato;
 
 
+import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
@@ -42,7 +42,7 @@ import org.opendaylight.yangtools.yang.common.RpcResult;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-/**
+/*
  * @author santanu.de@xoriant.com
  */
 
@@ -65,8 +65,7 @@ public class LegatoServiceController extends UnimgrDataTreeChangeListener<Evc> {
             .child(SubscriberServices.class).build();
 
     private ListenerRegistration<LegatoServiceController> dataTreeChangeListenerRegistration;
-
-    private static final Map<String, String> EVC_UUIDMAP = new HashMap<String, String>();
+    private static final Map<String, List<String>> EVC_UUID_MAP_LIST = new HashMap<String, List<String>>();
 
     private TapiConnectivityService prestoConnectivityService;
 
@@ -76,7 +75,7 @@ public class LegatoServiceController extends UnimgrDataTreeChangeListener<Evc> {
     }
 
     public void registerListener() {
-        LOG.info("Initializing LegatoServiceController:int() ");
+        LOG.trace("Initializing LegatoServiceController:int() ");
 
         assert prestoConnectivityService != null;
 
@@ -93,7 +92,7 @@ public class LegatoServiceController extends UnimgrDataTreeChangeListener<Evc> {
 
     @Override
     public void add(DataTreeModification<Evc> newDataObject) {
-        LOG.info("  Node Added  " + newDataObject.getRootNode().getIdentifier());
+        LOG.info("  Node Added  {}", newDataObject.getRootNode().getIdentifier());
 
         Optional<Evc> optionalEvc =
                 LegatoUtils.readEvc(dataBroker, LogicalDatastoreType.CONFIGURATION, newDataObject
@@ -106,16 +105,14 @@ public class LegatoServiceController extends UnimgrDataTreeChangeListener<Evc> {
 
     @Override
     public void remove(DataTreeModification<Evc> removedDataObject) {
-        LOG.info("  Node removed  "
-                + removedDataObject.getRootNode().getIdentifier());
+        LOG.trace("  Node removed {}", removedDataObject.getRootNode().getIdentifier());
 
         deleteNode(removedDataObject.getRootNode().getDataBefore());
     }
 
     @Override
     public void update(DataTreeModification<Evc> modifiedDataObject) {
-        LOG.info("  Node modified  "
-                + modifiedDataObject.getRootNode().getIdentifier());
+        LOG.trace("  Node modified {}", modifiedDataObject.getRootNode().getIdentifier());
         Optional<Evc> optionalEvc = LegatoUtils.readEvc(dataBroker,
                 LogicalDatastoreType.CONFIGURATION, modifiedDataObject
                         .getRootPath().getRootIdentifier());
@@ -127,77 +124,120 @@ public class LegatoServiceController extends UnimgrDataTreeChangeListener<Evc> {
     }
 
     private void addNode(Evc evc) {
-        LOG.info(" inside addNode()");
+        LOG.trace(" inside addNode()");
 
-        try {
-            assert evc != null;
-            createConnection(evc);
-
-        } catch (Exception ex) {
-            LOG.error("error: ", ex);
-        }
-
-        LOG.info(" ********** END addNode() ****************** ");
+        assert evc != null;
+        createConnection(evc);
 
+        LOG.trace(" ********** END addNode() ****************** ");
     }
 
     private void updateNode(Evc evc) {
-        LOG.info(" inside updateNode()");
+        LOG.trace(" inside updateNode()");
 
-        try {
-            assert evc != null;
-            updateConnection(evc);
+        assert evc != null;
+        updateConnection(evc);
 
-        } catch (Exception ex) {
-            LOG.error("error: ", ex);
-        }
-
-        LOG.info(" ********** END updateNode() ****************** ");
+        LOG.trace(" ********** END updateNode() ****************** ");
 
     }
 
     private void deleteNode(Evc evc) {
-        LOG.info(" inside deleteNode()");
+        LOG.trace(" inside deleteNode()");
 
-        try {
-            assert evc != null;
-            deleteConnection(evc.getEvcId().getValue());
-        } catch (Exception ex) {
-            LOG.error("error: ", ex);
-        }
+        assert evc != null;
+        deleteConnection(evc);
 
-        LOG.info(" ********** END deleteNode() ****************** ");
+        LOG.trace(" ********** END deleteNode() ****************** ");
     }
 
+    @SuppressWarnings("checkstyle:illegalcatch")
     private void createConnection(Evc evc) {
-        LOG.info("inside createConnection()");
+        LOG.trace("inside createConnection()");
 
         try {
             EVCDao evcDao =  LegatoUtils.parseNodes(evc);
+            LOG.trace("========" + evcDao.getUniVlanIdList().toString());
             assert evcDao != null
-                    && evcDao.getUniList() != null && evcDao.getConnectionType() != null;
-            LOG.info(" connection-type :{}, svc-type :{}", evcDao.getConnectionType(), evcDao.getSvcType());
+                    && evcDao.getUniIdList() != null && evcDao.getConnectionType() != null;
+            LOG.trace(" connection-type :{}, svc-type :{}", evcDao.getConnectionType(), evcDao.getSvcType());
 
             if (!evcDao.getSvcType().equalsIgnoreCase("other")) {
                 if ((evcDao.getSvcType().equalsIgnoreCase(LegatoConstants.EPL)
                         || evcDao.getSvcType().equalsIgnoreCase(LegatoConstants.EVPL))
                         && (!evcDao.getConnectionType().replace("-", "")
                                 .equalsIgnoreCase(LegatoConstants.POINTTOPOINT))) {
-                    LOG.info(
-                            "connection-type in payload should be point-to-point when svc-type is epl/evpl");
+                    LOG.trace("connection-type should be point-to-point when svc-type is epl/evpl");
                 } else if ((evcDao.getSvcType().equalsIgnoreCase(LegatoConstants.EPLAN)
                         || evcDao.getSvcType().equalsIgnoreCase(LegatoConstants.EVPLAN))
                         && (!evcDao.getConnectionType().replace("-", "")
                                 .equalsIgnoreCase(LegatoConstants.MULTIPOINTTOMULTIPOINT))) {
-                    LOG.info(
-                            "connection-type in payload should be multipoint-to-multipoint when svc-type is eplan/evplan");
+                    LOG.trace("connection-type should be multipoint-to-multipoint when svc-type is eplan/evplan");
+                } else if ((evcDao.getSvcType().equalsIgnoreCase(LegatoConstants.EPTREE)
+                        || evcDao.getSvcType().equalsIgnoreCase(LegatoConstants.EVPTREE))
+                        && (!evcDao.getConnectionType().replace("-", "")
+                                .equalsIgnoreCase(LegatoConstants.ROOTEDMULTIPOINT))) {
+                    LOG.trace("connection-type should be rooted-multipoint when svc-type is eptree/evptree");
                 } else {
-                    callCreateConnectionService(
-                            LegatoUtils.buildCreateConnectivityServiceInput(evcDao),
-                            evcDao.getEvcId());
+                    assert evcDao.getUniVlanIdList() != null;
+                    List<String> vlanIdList = LegatoUtils.validateVlanTag(evcDao);
+
+                    if (vlanIdList.size() > 0) {
+                        List<String> uuidList = new ArrayList<String>();
+                        for (int i = 0; i < vlanIdList.size(); i++) {
+                            if (callCreateConnectionService(
+                                    LegatoUtils.buildCreateConnectivityServiceInput(evcDao, vlanIdList.get(i),
+                                        evc.getEndPoints().getEndPoint()),
+                                    evcDao.getEvcId(), uuidList)) {
+                                LOG.trace("call callCreateConnectionService()");
+                            } else {
+                                // Safe option is to remove created connectivity services if one of them fails.
+                                deleteConnection(evc);
+                                uuidList = null;
+                                break;
+                            }
+                        }
+
+                        if (uuidList != null && uuidList.size() > 0) {
+                            EVC_UUID_MAP_LIST.put(evcDao.getEvcId(), uuidList);
+
+                            Optional<Evc> optionalEvc = LegatoUtils.readEvc(
+                                    dataBroker,
+                                    LogicalDatastoreType.CONFIGURATION,
+                                    InstanceIdentifier
+                                            .create(MefServices.class)
+                                            .child(CarrierEthernet.class)
+                                            .child(SubscriberServices.class)
+                                            .child(Evc.class,
+                                                    new EvcKey(new EvcIdType(evcDao.getEvcId()))));
+
+                            // Add Node in OPERATIONAL DB
+                            if (optionalEvc.isPresent()) {
+                                LegatoUtils.updateEvcInOperationalDB(optionalEvc.get(), EVC_IID_OPERATIONAL,
+                                        dataBroker);
+                            }
+                        }
+                        LOG.trace("EVC_UUID_MAP_LIST  " + EVC_UUID_MAP_LIST.toString());
+                    } else {
+                        if (evcDao.getSvcType().equalsIgnoreCase(LegatoConstants.EVPL)
+                              || evcDao.getSvcType().equalsIgnoreCase(LegatoConstants.EVPLAN)
+                              || evcDao.getSvcType().equalsIgnoreCase(LegatoConstants.EVPTREE)) {
+
+                            LegatoUtils.removeFlowFromConfigDatastore(
+                                        InstanceIdentifier.create(MefServices.class)
+                                        .child(CarrierEthernet.class)
+                                        .child(SubscriberServices.class)
+                                        .child(Evc.class,
+                                         new EvcKey(new EvcIdType(evcDao.getEvcId()))),
+                                         dataBroker);
+
+                            LOG.error("Service Type : {}, EVC ID : {} is removed successfully "
+                                + "from configuration datastore.", evcDao.getSvcType() , evcDao.getEvcId());
+                        }
+                    }
                 }
             } else {
-                LOG.info("svc-type in payload should be epl, evpl, eplan, evplan");
+                LOG.trace("svc-type in payload should be epl, evpl, eplan, evplan, evptree");
             }
 
         } catch (Exception ex) {
@@ -206,48 +246,51 @@ public class LegatoServiceController extends UnimgrDataTreeChangeListener<Evc> {
 
     }
 
+    @SuppressWarnings("checkstyle:illegalcatch")
     private void updateConnection(Evc evc) {
-        LOG.info("inside updateConnection()");
+        LOG.trace("inside updateConnection()");
 
         try {
             EVCDao evcDao = LegatoUtils.parseNodes(evc);
-            assert evcDao != null && evcDao.getUniList() != null
+            assert evcDao != null && evcDao.getUniIdList() != null
                     && evcDao.getConnectionType() != null;
-            LOG.info(" connection-type :{}, svc-type :{} ", evcDao.getConnectionType(), evcDao.getSvcType());
+            LOG.trace(" connection-type :{}, svc-type :{} ", evcDao.getConnectionType(), evcDao.getSvcType());
 
             if (!evcDao.getSvcType().equalsIgnoreCase("other")) {
                 if ((evcDao.getSvcType().equalsIgnoreCase(LegatoConstants.EPL)
                         || evcDao.getSvcType().equalsIgnoreCase(LegatoConstants.EVPL))
                         && (!evcDao.getConnectionType().replace("-", "")
                                 .equalsIgnoreCase(LegatoConstants.POINTTOPOINT))) {
-                    LOG.info(
-                            "connection-type in payload should be point-to-point when svc-type is epl/evpl");
+                    LOG.trace("connection-type should be point-to-point when svc-type is epl/evpl");
                 } else if ((evcDao.getSvcType().equalsIgnoreCase(LegatoConstants.EPLAN)
                         || evcDao.getSvcType().equalsIgnoreCase(LegatoConstants.EVPLAN))
                         && (!evcDao.getConnectionType().replace("-", "")
                                 .equalsIgnoreCase(LegatoConstants.MULTIPOINTTOMULTIPOINT))) {
-                    LOG.info(
-                            "connection-type in payload should be multipoint-to-multipoint when svc-type is eplan/evplan");
+                    LOG.trace("connection-type should be multipoint-to-multipoint when svc-type is eplan/evplan");
+                } else if ((evcDao.getSvcType().equalsIgnoreCase(LegatoConstants.EPTREE)
+                        || evcDao.getSvcType().equalsIgnoreCase(LegatoConstants.EVPTREE))
+                        && (!evcDao.getConnectionType().replace("-", "")
+                                .equalsIgnoreCase(LegatoConstants.ROOTEDMULTIPOINT))) {
+                    LOG.trace("connection-type should be rooted-multipoint when svc-type is eptree/evptree");
                 } else {
-                    if (EVC_UUIDMAP.containsKey(evcDao.getEvcId())) {
-                        LOG.info("Update UUID: {} of EVC Id: {} ",
-                                EVC_UUIDMAP.get(evcDao.getEvcId()), evcDao.getEvcId());
-
-                        List<String> uniList = evcDao.getUniList();
-                        assert uniList != null && uniList.size() > 0;
-
-                        for (String uniStr : uniList) {
-                            callUpdateConnectionService(
-                                    LegatoUtils.buildUpdateConnectivityServiceInput(evcDao, uniStr,
-                                            EVC_UUIDMAP.get(evcDao.getEvcId())),
-                                    evcDao.getEvcId());
+                    if (EVC_UUID_MAP_LIST.containsKey(evcDao.getEvcId())) {
+                        LOG.trace("Update UUID: {} of EVC Id: {} ",
+                                EVC_UUID_MAP_LIST.get(evcDao.getEvcId()), evcDao.getEvcId());
+                        assert evcDao.getUniVlanIdList() != null;
+                        List<String> vlanIdList = LegatoUtils.validateVlanTag(evcDao);
+
+                        LOG.trace(" number of noOfVlan = " + vlanIdList.toString());
+                        if (vlanIdList.size() > 0) {
+                            // delete existing EVC and create service
+                            deleteConnection(evc);
+                            createConnection(evc);
                         }
                     } else {
-                        LOG.info("UUID does not exists for EVC Id : {}", evcDao.getEvcId());
+                        LOG.trace("UUID does not exists for EVC Id : {}", evcDao.getEvcId());
                     }
                 }
             } else {
-                LOG.info("svc-type in payload should be epl, evpl, eplan, evplan");
+                LOG.trace("svc-type in payload should be epl, evpl, eplan, evplan, eptree, evptree");
             }
         } catch (Exception ex) {
 
@@ -256,20 +299,25 @@ public class LegatoServiceController extends UnimgrDataTreeChangeListener<Evc> {
 
     }
 
-    private void deleteConnection(String evcId) {
-        LOG.info(" inside deleteConnection()");
+    @SuppressWarnings("checkstyle:illegalcatch")
+    private void deleteConnection(Evc evc) {
+        LOG.trace(" inside deleteConnection()");
         try {
-
-            assert EVC_UUIDMAP != null;
-
-            if (EVC_UUIDMAP.containsKey(evcId)) {
-                LOG.info("Deleting UUID: {} of EVC Id: {} ",
-                        EVC_UUIDMAP.get(evcId), evcId);
-                // on successful deletion of service, remove respective element from evc_UUIDMap
-                if (callDeleteConnectionService(new DeleteConnectivityServiceInputBuilder()
-                        .setServiceIdOrName(EVC_UUIDMAP.get(evcId)).build())) {
-                    EVC_UUIDMAP.remove(evcId);
+            assert evc != null && EVC_UUID_MAP_LIST != null;
+            String evcId = evc.getEvcId().getValue();
+
+            if (EVC_UUID_MAP_LIST.containsKey(evcId)) {
+                LOG.trace("Deleting UUID: {} of EVC Id: {} ",
+                        EVC_UUID_MAP_LIST.get(evcId), evcId);
+
+                for (String uuid : EVC_UUID_MAP_LIST.get(evcId)) {
+                    // on successful deletion of service, remove respective element from EVC_UUID_MAP_LIST
+                    if (callDeleteConnectionService(new DeleteConnectivityServiceInputBuilder()
+                            .setServiceIdOrName(uuid).build())) {
+                        LOG.trace("UUID {} is deleted successfully ", uuid);
+                    }
                 }
+                EVC_UUID_MAP_LIST.remove(evcId);
 
                 // delete EVC node from OPERATIONAL DB
                 LegatoUtils.deleteFromOperationalDB(InstanceIdentifier
@@ -278,58 +326,45 @@ public class LegatoServiceController extends UnimgrDataTreeChangeListener<Evc> {
                         .child(Evc.class, new EvcKey(new EvcIdType(evcId))), dataBroker);
 
             } else {
-                LOG.info("UUID does not exists for EVC Id : {}", evcId);
+                LOG.trace("UUID does not exists for EVC Id : {}", evcId);
             }
 
         } catch (Exception ex) {
-            LOG.error("error: ", ex);
+            LOG.error(LegatoConstants.ERROR, ex);
         }
 
-        LOG.info(" ********** END deleteConnection() ****************** ");
+        LOG.trace(" ********** END deleteConnection() ****************** ");
     }
 
-    private void callCreateConnectionService(
-            CreateConnectivityServiceInput createConnServiceInput, String evcId) {
+    @SuppressWarnings("checkstyle:illegalcatch")
+    private boolean callCreateConnectionService(
+            CreateConnectivityServiceInput createConnServiceInput, String evcId, List<String> uuidList) {
         try {
             Future<RpcResult<CreateConnectivityServiceOutput>> response = this.prestoConnectivityService
                     .createConnectivityService(createConnServiceInput);
 
             if (response.get().isSuccessful()) {
-                LOG.info("call Success = {}, response = {} ", response.get()
+                LOG.trace("call Success = {}, response = {} ", response.get()
                         .isSuccessful(), response.get().getResult());
-                LOG.info("evcId = {}, UUID = {} ", evcId, response.get()
+                LOG.trace("evcId = {}, UUID = {} ", evcId, response.get()
                         .getResult().getService().getUuid().getValue());
-
-                EVC_UUIDMAP.put(evcId, response.get().getResult().getService()
+                uuidList.add(response.get().getResult().getService()
                         .getUuid().getValue());
 
-                LOG.info("======== {} ", EVC_UUIDMAP.toString());
-
-                Optional<Evc> optionalEvc = LegatoUtils.readEvc(
-                        dataBroker,
-                        LogicalDatastoreType.CONFIGURATION,
-                        InstanceIdentifier
-                                .create(MefServices.class)
-                                .child(CarrierEthernet.class)
-                                .child(SubscriberServices.class)
-                                .child(Evc.class,
-                                        new EvcKey(new EvcIdType(evcId))));
-
-                // Add Node in OPERATIONAL DB
-                if (optionalEvc.isPresent()) {
-                    LegatoUtils.updateEvcInOperationalDB(optionalEvc.get(), EVC_IID_OPERATIONAL,
-                            dataBroker);
-                }
+                return true;
 
             } else {
-                LOG.info("call Failure = {} >> {} ", response.get()
+                LOG.trace("call Failure = {} >> {} ", response.get()
                         .isSuccessful(), response.get().getErrors());
+                return false;
             }
         } catch (Exception ex) {
             LOG.error("Error in callCreateConnectionService(). Err: ", ex);
+            return false;
         }
     }
 
+    @SuppressWarnings("checkstyle:illegalcatch")
     private void callUpdateConnectionService(
             UpdateConnectivityServiceInput updateConnectivityServiceInput,
             String evcId) {
@@ -338,7 +373,7 @@ public class LegatoServiceController extends UnimgrDataTreeChangeListener<Evc> {
                     .updateConnectivityService(updateConnectivityServiceInput);
 
             if (response.get().isSuccessful()) {
-                LOG.info("call Success = {}, response = {} ", response.get()
+                LOG.trace("call Success = {}, response = {} ", response.get()
                         .isSuccessful(), response.get().getResult());
 
                 Optional<Evc> optionalEvc = LegatoUtils.readEvc(
@@ -363,15 +398,15 @@ public class LegatoServiceController extends UnimgrDataTreeChangeListener<Evc> {
                 }
 
             } else {
-                LOG.info("call Failure = {} >> {} ", response.get()
+                LOG.trace("call Failure = {} >> {} ", response.get()
                         .isSuccessful(), response.get().getErrors());
             }
         } catch (Exception ex) {
-
             LOG.error("Error in UpdateConnectivityServiceInput(). Err: ", ex);
         }
     }
 
+    @SuppressWarnings("checkstyle:illegalcatch")
     private boolean callDeleteConnectionService(
             DeleteConnectivityServiceInput deleteConnectivityServiceInput) {
         try {
diff --git a/legato-api/src/main/java/org/opendaylight/unimgr/mef/legato/LegatoSlsProfileController.java b/legato-api/src/main/java/org/opendaylight/unimgr/mef/legato/LegatoSlsProfileController.java
deleted file mode 100644 (file)
index 5e1e705..0000000
+++ /dev/null
@@ -1,159 +0,0 @@
-/*
- * Copyright (c) 2018 Xoriant Corporation and others. All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-
-package org.opendaylight.unimgr.mef.legato;
-
-import java.util.Collections;
-import java.util.Optional;
-
-import org.opendaylight.mdsal.binding.api.DataBroker;
-import org.opendaylight.mdsal.binding.api.DataTreeIdentifier;
-import org.opendaylight.mdsal.binding.api.DataTreeModification;
-import org.opendaylight.mdsal.common.api.LogicalDatastoreType;
-import org.opendaylight.unimgr.api.UnimgrDataTreeChangeListener;
-import org.opendaylight.unimgr.mef.legato.util.LegatoConstants;
-import org.opendaylight.unimgr.mef.legato.util.LegatoUtils;
-import org.opendaylight.yang.gen.v1.urn.mef.yang.mef.global.rev171215.MefGlobal;
-import org.opendaylight.yang.gen.v1.urn.mef.yang.mef.global.rev171215.mef.global.SlsProfiles;
-import org.opendaylight.yang.gen.v1.urn.mef.yang.mef.global.rev171215.mef.global.SlsProfilesBuilder;
-import org.opendaylight.yang.gen.v1.urn.mef.yang.mef.global.rev171215.mef.global.sls.profiles.Profile;
-import org.opendaylight.yang.gen.v1.urn.mef.yang.mef.global.rev171215.mef.global.sls.profiles.ProfileKey;
-import org.opendaylight.yangtools.concepts.ListenerRegistration;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-
-/**
- * @author Arif.Hussain@Xoriant.Com
- */
-
-public class LegatoSlsProfileController  extends UnimgrDataTreeChangeListener<Profile> {
-
-    public LegatoSlsProfileController(final DataBroker dataBroker) {
-        super(dataBroker);
-        registerListener();
-    }
-
-    private static final Logger LOG = LoggerFactory
-            .getLogger(LegatoSlsProfileController.class);
-
-
-    private static final InstanceIdentifier<Profile> PROFILE_IID = InstanceIdentifier
-            .builder(MefGlobal.class).child(SlsProfiles.class).child(Profile.class).build();
-
-    private static final InstanceIdentifier<SlsProfiles> SLS_PROFILES_IID_OPERATIONAL = InstanceIdentifier
-            .builder(MefGlobal.class).child(SlsProfiles.class).build();
-
-    private ListenerRegistration<LegatoSlsProfileController> dataTreeChangeListenerRegistration;
-
-    public void registerListener() {
-        LOG.info("Initializing LegatoSlsProfileController:init() ");
-
-        dataTreeChangeListenerRegistration = dataBroker.registerDataTreeChangeListener(
-                DataTreeIdentifier.create(LogicalDatastoreType.CONFIGURATION, PROFILE_IID), this);
-
-    }
-
-
-    @Override
-    public void close() throws Exception {
-        if (dataTreeChangeListenerRegistration != null) {
-            dataTreeChangeListenerRegistration.close();
-        }
-    }
-
-
-    @Override
-    public void add(DataTreeModification<Profile> newDataObject) {
-        LOG.info("  Node Added  " + newDataObject.getRootNode().getIdentifier());
-        addToOperationalDB(newDataObject.getRootNode().getDataAfter());
-    }
-
-
-    public void addToOperationalDB(Profile profileObj) {
-        LOG.info(" inside addNode()");
-        try {
-            assert profileObj != null;
-
-            SlsProfiles profile = new SlsProfilesBuilder().setProfile(Collections.singletonList(profileObj)).build();
-            LegatoUtils.addToOperationalDB(profile, SLS_PROFILES_IID_OPERATIONAL, dataBroker);
-        } catch (Exception e) {
-            LOG.error("Error in addNode(). Err: ", e);
-        }
-        LOG.info(" ********** END addNode() ****************** ");
-    }
-
-
-    @Override
-    public void update(DataTreeModification<Profile> modifiedDataObject) {
-        if (modifiedDataObject.getRootNode() != null && modifiedDataObject.getRootPath() != null) {
-            LOG.info("  Node modified  " + modifiedDataObject.getRootNode().getIdentifier());
-            try {
-                assert modifiedDataObject.getRootNode().getDataAfter() != null;
-                updateNode(modifiedDataObject.getRootNode().getDataAfter());
-            } catch (Exception ex) {
-                LOG.error("error: ", ex);
-            }
-        }
-    }
-
-
-    @SuppressWarnings("unchecked")
-    public void updateNode(Profile profile) {
-        LOG.info(" inside updateNode()");
-
-        assert profile != null;
-        Optional<Profile> optionalProfile =
-                (Optional<Profile>) LegatoUtils.readProfile(LegatoConstants.SLS_PROFILES,
-                        dataBroker, LogicalDatastoreType.CONFIGURATION,
-                        InstanceIdentifier.create(MefGlobal.class).child(SlsProfiles.class)
-                                .child(Profile.class, new ProfileKey(profile.getId())));
-
-        if (optionalProfile.isPresent()) {
-
-            LegatoUtils
-                    .deleteFromOperationalDB(
-                            InstanceIdentifier.create(MefGlobal.class).child(SlsProfiles.class)
-                                    .child(Profile.class, new ProfileKey(profile.getId())),
-                            dataBroker);
-
-            addToOperationalDB(optionalProfile.get());
-        }
-        LOG.info(" ********** END updateNode() ****************** ");
-    }
-
-
-    @Override
-    public void remove(DataTreeModification<Profile> removedDataObject) {
-        if (removedDataObject.getRootNode() != null && removedDataObject.getRootPath() != null) {
-            LOG.info("  Node removed  " + removedDataObject.getRootNode().getIdentifier());
-
-            deleteNode(removedDataObject.getRootNode().getDataBefore());
-        }
-    }
-
-    public void deleteNode(Profile profileObj) {
-        LOG.info(" inside deleteNode()");
-
-        try {
-            assert profileObj != null;
-            LegatoUtils
-                    .deleteFromOperationalDB(
-                            InstanceIdentifier.create(MefGlobal.class).child(SlsProfiles.class)
-                                    .child(Profile.class, new ProfileKey(profileObj.getId())),
-                            dataBroker);
-
-        } catch (Exception ex) {
-            LOG.error("error: ", ex);
-        }
-
-        LOG.info(" ********** END deleteNode() ****************** ");
-    }
-
-}
index 311c568f1a3518ff48184859af984b4b17456bfb..72221508e9aa1c8a9d95fd28eb329752a3b446c9 100644 (file)
@@ -8,7 +8,9 @@
 package org.opendaylight.unimgr.mef.legato.dao;
 
 import java.util.List;
-/**
+import java.util.Map;
+
+/*
  * @author santanu.de@xoriant.com
  */
 
@@ -18,7 +20,9 @@ public class EVCDao {
     private Integer maxFrameSize;
     private String connectionType;
     private String svcType;
-    private List<String> uniList;
+    private List<String> uniIdList;
+    private Map<String, List<String>> uniVlanIdList;
+
 
     public String getEvcId() {
         return evcId;
@@ -52,12 +56,20 @@ public class EVCDao {
         this.svcType = svcType;
     }
 
-    public List<String> getUniList() {
-        return uniList;
+    public List<String> getUniIdList() {
+        return uniIdList;
+    }
+
+    public void setUniIdList(List<String> uniIdList) {
+        this.uniIdList = uniIdList;
+    }
+
+    public Map<String, List<String>> getUniVlanIdList() {
+        return uniVlanIdList;
     }
 
-    public void setUniList(List<String> uniList) {
-        this.uniList = uniList;
+    public void setUniVlanList(Map<String, List<String>> inputUniVlanIdList) {
+        this.uniVlanIdList = inputUniVlanIdList;
     }
 
 }
index ffd0b0a6d3957a8d9d244951c6594e7363bca69f..aa9ee370d301faf7ee5d6f925323dc323baae03b 100644 (file)
@@ -10,12 +10,16 @@ package org.opendaylight.unimgr.mef.legato.util;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Uri;
 import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.TopologyId;
 
-/**
+/*
  * @author santanu.de@xoriant.com
  */
 
-public class LegatoConstants {
-    
+public final class LegatoConstants {
+
+    private LegatoConstants() {
+        throw new IllegalStateException(LegatoConstants.CONSTANTS);
+    }
+
     public static final String EVC_CON_TYPE = "EVC_CON_TYPE";
 
     public static final String BEST_EFFORT = "BEST_EFFORT";
@@ -32,6 +36,8 @@ public class LegatoConstants {
 
     public static final String MULTIPOINTTOMULTIPOINT = "MULTIPOINTTOMULTIPOINT";
 
+    public static final String ROOTEDMULTIPOINT = "ROOTEDMULTIPOINT";
+
     public static final String L2CP_EEC_PROFILES = "l2CP_EEC_PROFILES";
 
     public static final String L2CP_PEERING_PROFILES = "L2CP_PEERING_PROFILES";
@@ -49,4 +55,12 @@ public class LegatoConstants {
     public static final String EPLAN = "eplan";
 
     public static final String EVPLAN = "evplan";
+
+    public static final String EPTREE = "eptree";
+
+    public static final String EVPTREE = "evptree";
+
+    public static final String ERROR = "error: ";
+
+    public static final String CONSTANTS = "Legato constants class";
 }
index bdb29de6738e1e0260b2e614446cb0de9070301d..130f1fd3cd32eb0c54c9a9be9198eb7c1b2f3e67 100644 (file)
@@ -8,7 +8,10 @@
 package org.opendaylight.unimgr.mef.legato.util;
 
 import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
 import java.util.Optional;
 import java.util.concurrent.ExecutionException;
 
@@ -18,10 +21,14 @@ import org.opendaylight.mdsal.binding.api.WriteTransaction;
 import org.opendaylight.mdsal.common.api.LogicalDatastoreType;
 import org.opendaylight.unimgr.mef.legato.dao.EVCDao;
 import org.opendaylight.yang.gen.v1.urn.mef.yang.mef.common.types.rev180321.PositiveInteger;
+import org.opendaylight.yang.gen.v1.urn.mef.yang.mef.legato.services.rev171215.MefServices;
+import org.opendaylight.yang.gen.v1.urn.mef.yang.mef.legato.services.rev171215.mef.services.CarrierEthernet;
 import org.opendaylight.yang.gen.v1.urn.mef.yang.mef.legato.services.rev171215.mef.services.carrier.ethernet.SubscriberServices;
 import org.opendaylight.yang.gen.v1.urn.mef.yang.mef.legato.services.rev171215.mef.services.carrier.ethernet.SubscriberServicesBuilder;
 import org.opendaylight.yang.gen.v1.urn.mef.yang.mef.legato.services.rev171215.mef.services.carrier.ethernet.subscriber.services.Evc;
+import org.opendaylight.yang.gen.v1.urn.mef.yang.mef.legato.services.rev171215.mef.services.carrier.ethernet.subscriber.services.EvcKey;
 import org.opendaylight.yang.gen.v1.urn.mef.yang.mef.legato.services.rev171215.mef.services.carrier.ethernet.subscriber.services.evc.end.points.EndPoint;
+import org.opendaylight.yang.gen.v1.urn.mef.yang.mef.types.rev171215.EvcIdType;
 import org.opendaylight.yang.gen.v1.urn.mef.yang.mef.types.rev171215.VlanIdType;
 import org.opendaylight.yang.gen.v1.urn.mef.yang.nrm.connectivity.rev180321.carrier.eth.connectivity.end.point.resource.CeVlanIdListAndUntagBuilder;
 import org.opendaylight.yang.gen.v1.urn.mef.yang.nrm.connectivity.rev180321.vlan.id.list.and.untag.VlanId;
@@ -58,60 +65,78 @@ import org.slf4j.LoggerFactory;
 
 import com.google.common.util.concurrent.FluentFuture;
 
-/**
+/*
  * @author santanu.de@xoriant.com
  */
 
-public class LegatoUtils {
+public final class LegatoUtils {
+
+    private LegatoUtils() {
+        throw new IllegalStateException("Legato utils class");
+    }
 
     private static final Logger LOG = LoggerFactory.getLogger(LegatoUtils.class);
 
     public static EVCDao parseNodes(Evc evc) {
-        List<String> uniList = new ArrayList<String>();
+        assert evc != null;
+        assert evc.getEndPoints().getEndPoint() != null
+                && evc.getEndPoints().getEndPoint().size() > 0;
+
+        List<String> uniIdList = new ArrayList<String>();
+        List<String> vlanIdList;
+        Map<String, List<String>> uniVlanList = new HashMap<String, List<String>>();
         String vlanId;
-        EVCDao evcDao = new EVCDao();
 
-        assert evc != null;
-        uniList = new ArrayList<String>();
-        assert evc.getEndPoints().getEndPoint() != null && evc.getEndPoints().getEndPoint().size() > 0;
         for (EndPoint endPoint : evc.getEndPoints().getEndPoint()) {
             vlanId = "0";
+            vlanIdList = new ArrayList<String>();
             assert endPoint.getCeVlans().getCeVlan() != null;
-            for (VlanIdType vlanIdType : endPoint.getCeVlans().getCeVlan()) {
-                vlanId = vlanIdType.getValue().toString();
+            if (endPoint.getCeVlans().getCeVlan().size() > 0) {
+                for (VlanIdType vlanIdType : endPoint.getCeVlans().getCeVlan()) {
+                    vlanId = vlanIdType.getValue().toString();
+                    vlanIdList.add(vlanId);
+                }
+            } else {
+                vlanIdList.add(vlanId);
             }
-
-            uniList.add(endPoint.getUniId().getValue().toString() + "#" + vlanId);
+            uniVlanList.put(endPoint.getUniId().getValue().toString(), vlanIdList);
+            uniIdList.add(endPoint.getUniId().getValue().toString());
         }
 
+        final EVCDao evcDao = new EVCDao();
         evcDao.setEvcId(evc.getEvcId().getValue());
-        evcDao.setMaxFrameSize((evc.getMaxFrameSize().getValue() != null) ? evc.getMaxFrameSize().getValue() : 0);
-        evcDao.setConnectionType((evc.getConnectionType().getName() != null) ? evc.getConnectionType().getName() : "");
+        evcDao.setMaxFrameSize(
+                (evc.getMaxFrameSize().getValue() != null) ? evc.getMaxFrameSize().getValue() : 0);
+        evcDao.setConnectionType(
+                (evc.getConnectionType().getName() != null) ? evc.getConnectionType().getName()
+                        : "");
         evcDao.setSvcType(evc.getSvcType().getName());
-        evcDao.setUniList(uniList);
+        evcDao.setUniIdList(uniIdList);
+        evcDao.setUniVlanList(uniVlanList);
+
         return evcDao;
     }
 
     public static EndPoint2 buildCreateEthConnectivityEndPointAugmentation(String vlanId) {
-        return new EndPoint2Builder()
-                .setNrpCarrierEthConnectivityEndPointResource(buildNrpCarrierEthConnectivityEndPointResource(vlanId))
-                .build();
+        return new EndPoint2Builder().setNrpCarrierEthConnectivityEndPointResource(
+                buildNrpCarrierEthConnectivityEndPointResource(vlanId)).build();
     }
 
     public static EndPoint7 buildUpdateEthConnectivityEndPointAugmentation(String vlanId) {
-        return new EndPoint7Builder()
-                .setNrpCarrierEthConnectivityEndPointResource(buildNrpCarrierEthConnectivityEndPointResource(vlanId))
-                .build();
+        return new EndPoint7Builder().setNrpCarrierEthConnectivityEndPointResource(
+                buildNrpCarrierEthConnectivityEndPointResource(vlanId)).build();
     }
 
-    public static CreateConnectivityServiceInput1 buildCreateConServiceAugmentation(String maxFrameSize) {
-        return new CreateConnectivityServiceInput1Builder()
-                .setNrpCarrierEthConnectivityResource(buildNrpCarrierEthConnectivityResource(maxFrameSize)).build();
+    public static CreateConnectivityServiceInput1 buildCreateConServiceAugmentation(
+            String maxFrameSize) {
+        return new CreateConnectivityServiceInput1Builder().setNrpCarrierEthConnectivityResource(
+                buildNrpCarrierEthConnectivityResource(maxFrameSize)).build();
     }
 
-    public static UpdateConnectivityServiceInput1 buildUpdateConServiceAugmentation(String maxFrameSize) {
-        return new UpdateConnectivityServiceInput1Builder()
-                .setNrpCarrierEthConnectivityResource(buildNrpCarrierEthConnectivityResource(maxFrameSize)).build();
+    public static UpdateConnectivityServiceInput1 buildUpdateConServiceAugmentation(
+            String maxFrameSize) {
+        return new UpdateConnectivityServiceInput1Builder().setNrpCarrierEthConnectivityResource(
+                buildNrpCarrierEthConnectivityResource(maxFrameSize)).build();
     }
 
     public static NrpCarrierEthConnectivityEndPointResource buildNrpCarrierEthConnectivityEndPointResource(
@@ -121,38 +146,42 @@ public class LegatoUtils {
                 new NrpCarrierEthConnectivityEndPointResourceBuilder();
 
         CeVlanIdListAndUntagBuilder ceVlanIdListAndUntagBuilder = new CeVlanIdListAndUntagBuilder();
-        List<VlanId> vlanList = new ArrayList<>();
+        List<VlanId> vlanList = new ArrayList<VlanId>();
         if (Integer.parseInt(vlanId) > 0) {
-            VlanIdBuilder vlanIdBuilder = new VlanIdBuilder().setVlanId(new PositiveInteger(Long.parseLong(vlanId)));
+            VlanIdBuilder vlanIdBuilder =
+                    new VlanIdBuilder().setVlanId(new PositiveInteger(Long.parseLong(vlanId)));
             vlanList.add(vlanIdBuilder.build());
         }
         ceVlanIdListAndUntagBuilder.setVlanId(vlanList);
-        nrpCarrierEthConnectivityEndPointResourceBuilder.setCeVlanIdListAndUntag(ceVlanIdListAndUntagBuilder.build());
+        nrpCarrierEthConnectivityEndPointResourceBuilder
+                .setCeVlanIdListAndUntag(ceVlanIdListAndUntagBuilder.build());
 
         return nrpCarrierEthConnectivityEndPointResourceBuilder.build();
     }
 
-    public static NrpCarrierEthConnectivityResource buildNrpCarrierEthConnectivityResource(String maxFrameSize) {
+    public static NrpCarrierEthConnectivityResource buildNrpCarrierEthConnectivityResource(
+            String maxFrameSize) {
         NrpCarrierEthConnectivityResourceBuilder nrpCarrierEthConnectivityResourceBuilder =
                 new NrpCarrierEthConnectivityResourceBuilder();
         return nrpCarrierEthConnectivityResourceBuilder
                 .setMaxFrameSize(new PositiveInteger(Long.parseLong(maxFrameSize))).build();
     }
 
-    public static CreateConnectivityServiceInput buildCreateConnectivityServiceInput(EVCDao evcDao) {
+    public static CreateConnectivityServiceInput buildCreateConnectivityServiceInput(EVCDao evcDao,
+            String vlanId, List<EndPoint> endpoints) {
 
-        CreateConnectivityServiceInputBuilder createConnServiceInputBuilder =
-                new CreateConnectivityServiceInputBuilder();
-        List<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev180307.create.connectivity.service.input.EndPoint> endpointList;
-        List<String> uniList = evcDao.getUniList();
         boolean isExclusive = false;
 
-        // if svc-type = epl/eplan then set is_exclusive flag as true
+        // if svc-type = epl, eplan or eptree then set is_exclusive flag as true
         if (evcDao.getSvcType().equalsIgnoreCase(LegatoConstants.EPL)
-                || evcDao.getSvcType().equalsIgnoreCase(LegatoConstants.EPLAN)) {
+                || evcDao.getSvcType().equalsIgnoreCase(LegatoConstants.EPLAN)
+                || evcDao.getSvcType().equalsIgnoreCase(LegatoConstants.EPTREE)) {
             isExclusive = true;
         }
 
+        CreateConnectivityServiceInputBuilder createConnServiceInputBuilder =
+                new CreateConnectivityServiceInputBuilder();
+
         switch (evcDao.getConnectionType().replace("-", "").toUpperCase()) {
             case LegatoConstants.POINTTOPOINT:
                 createConnServiceInputBuilder.setConnConstraint(new ConnConstraintBuilder()
@@ -164,20 +193,27 @@ public class LegatoUtils {
                         .setServiceLevel(LegatoConstants.BEST_EFFORT).setIsExclusive(isExclusive)
                         .setServiceType(ServiceType.MULTIPOINTCONNECTIVITY).build());
                 break;
+            case LegatoConstants.ROOTEDMULTIPOINT:
+                createConnServiceInputBuilder.setConnConstraint(new ConnConstraintBuilder()
+                        .setServiceLevel(LegatoConstants.BEST_EFFORT).setIsExclusive(isExclusive)
+                        .setServiceType(ServiceType.ROOTEDMULTIPOINTCONNECTIVITY).build());
+                break;
             default:
                 break;
         }
 
+        // if isExclusive == true i.e port bases service then set vlanId =0 to bypass given vlan tag
+        if (isExclusive) {
+            vlanId = "0";
+        }
 
         // build end points
-        assert uniList != null && uniList.size() > 0;
-        endpointList = buildCreateEndpoints(uniList, LayerProtocolName.ETH);
+        assert endpoints != null && endpoints.size() > 0;
 
-        createConnServiceInputBuilder.setEndPoint(endpointList);
+        createConnServiceInputBuilder.setEndPoint(buildCreateEndpoints(endpoints, LayerProtocolName.ETH, vlanId));
 
         createConnServiceInputBuilder.addAugmentation(CreateConnectivityServiceInput1.class,
                 LegatoUtils.buildCreateConServiceAugmentation(evcDao.getMaxFrameSize().toString()));
-
         return createConnServiceInputBuilder.build();
     }
 
@@ -185,28 +221,41 @@ public class LegatoUtils {
             String uniStr, String uuid) {
         boolean isExclusive = false;
 
-        UpdateConnectivityServiceInputBuilder updateConnServiceInputBuilder =
-                new UpdateConnectivityServiceInputBuilder();
-
-        // if svc-type = epl/eplan then set is_exclusive flag as true
+        // if svc-type = epl, eplan or eptree then set is_exclusive flag as true
         if (evcDao.getSvcType().equalsIgnoreCase(LegatoConstants.EPL)
-                || evcDao.getSvcType().equalsIgnoreCase(LegatoConstants.EPLAN)) {
+                || evcDao.getSvcType().equalsIgnoreCase(LegatoConstants.EPLAN)
+                || evcDao.getSvcType().equalsIgnoreCase(LegatoConstants.EPTREE)) {
             isExclusive = true;
         }
 
+        UpdateConnectivityServiceInputBuilder updateConnServiceInputBuilder =
+                new UpdateConnectivityServiceInputBuilder();
+
         switch (evcDao.getConnectionType().replace("-", "").toUpperCase()) {
             case LegatoConstants.POINTTOPOINT:
-                updateConnServiceInputBuilder
-                        .setConnConstraint(new org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev180307.update.connectivity.service.input.ConnConstraintBuilder()
-                                .setServiceLevel(LegatoConstants.BEST_EFFORT).setIsExclusive(isExclusive)
+                updateConnServiceInputBuilder.setConnConstraint(
+                        new org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev180307
+                            .update.connectivity.service.input.ConnConstraintBuilder()
+                                .setServiceLevel(LegatoConstants.BEST_EFFORT)
+                                .setIsExclusive(isExclusive)
                                 .setServiceType(ServiceType.POINTTOPOINTCONNECTIVITY).build());
                 break;
             case LegatoConstants.MULTIPOINTTOMULTIPOINT:
-                updateConnServiceInputBuilder
-                        .setConnConstraint(new org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev180307.update.connectivity.service.input.ConnConstraintBuilder()
-                                .setServiceLevel(LegatoConstants.BEST_EFFORT).setIsExclusive(isExclusive)
+                updateConnServiceInputBuilder.setConnConstraint(
+                        new org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev180307
+                            .update.connectivity.service.input.ConnConstraintBuilder()
+                                .setServiceLevel(LegatoConstants.BEST_EFFORT)
+                                .setIsExclusive(isExclusive)
                                 .setServiceType(ServiceType.MULTIPOINTCONNECTIVITY).build());
                 break;
+            case LegatoConstants.ROOTEDMULTIPOINT:
+                updateConnServiceInputBuilder.setConnConstraint(
+                        new org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev180307
+                            .update.connectivity.service.input.ConnConstraintBuilder()
+                                .setServiceLevel(LegatoConstants.BEST_EFFORT)
+                                .setIsExclusive(isExclusive)
+                                .setServiceType(ServiceType.ROOTEDMULTIPOINTCONNECTIVITY).build());
+                break;
             default:
                 break;
         }
@@ -220,48 +269,52 @@ public class LegatoUtils {
         return updateConnServiceInputBuilder.build();
     }
 
-    private static List<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev180307.create.connectivity.service.input.EndPoint> buildCreateEndpoints(
-            List<String> uniList, LayerProtocolName layerProtocolName) {
-        List<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev180307.create.connectivity.service.input.EndPoint> endpointList =
-                new ArrayList<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev180307.create.connectivity.service.input.EndPoint>();
+    private static List<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev180307
+        .create.connectivity.service.input.EndPoint> buildCreateEndpoints(
+            List<EndPoint> endpoints, LayerProtocolName layerProtocolName, String vlanId) {
+        List<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev180307
+            .create.connectivity.service.input.EndPoint> endpointList =
+                new ArrayList<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev180307
+                    .create.connectivity.service.input.EndPoint>();
 
         EndPointBuilder endPointBuilder;
-        String[] uniArr;
-
-        for (String uniStr : uniList) {
-            uniArr = uniStr.split("#");
-
+        for (org.opendaylight.yang.gen.v1.urn.mef.yang.mef.legato.services.rev171215
+            .mef.services.carrier.ethernet.subscriber.services.evc.end.points.EndPoint ep : endpoints) {
             ServiceInterfacePoint sipRef = new ServiceInterfacePointBuilder()
-                    .setServiceInterfacePointId(new Uuid(uniArr[0])).build();
+                    .setServiceInterfacePointId(new Uuid(ep.getUniId().getValue())).build();
 
-            endPointBuilder = new EndPointBuilder().setRole(PortRole.SYMMETRIC)
-                    .setLocalId("e:" + uniArr[0]).setServiceInterfacePoint(sipRef)
+            endPointBuilder = new EndPointBuilder()
+                    .setRole(ep.getRole().getName().equalsIgnoreCase(PortRole.ROOT.getName())
+                            ? PortRole.ROOT
+                            : PortRole.LEAF)
+                    .setLocalId("e:" + ep.getUniId().getValue()).setServiceInterfacePoint(sipRef)
                     .setDirection(PortDirection.BIDIRECTIONAL)
                     .setLayerProtocolName(layerProtocolName).addAugmentation(EndPoint2.class,
-                            LegatoUtils.buildCreateEthConnectivityEndPointAugmentation(uniArr[1]));
+                            LegatoUtils.buildCreateEthConnectivityEndPointAugmentation(vlanId));
 
             endpointList.add(endPointBuilder.build());
         }
-
         endPointBuilder = null;
-        uniArr = null;
 
         return endpointList;
     }
 
-    private static org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev180307.update.connectivity.service.input.EndPoint buildUpdateEndpoints(
+    private static org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev180307
+        .update.connectivity.service.input.EndPoint buildUpdateEndpoints(
             String uniStr, LayerProtocolName layerProtocolName) {
-        org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev180307.update.connectivity.service.input.EndPointBuilder endPointBuilder = new org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev180307.update.connectivity.service.input.EndPointBuilder();
+        org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev180307
+            .update.connectivity.service.input.EndPointBuilder endPointBuilder =
+                new org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev180307
+                    .update.connectivity.service.input.EndPointBuilder();
         String[] uniArr;
 
-        if (uniStr != null && !uniStr.trim().isEmpty()) {
+        if (!uniStr.isEmpty()) {
             uniArr = uniStr.split("#");
             ServiceInterfacePoint sipRef = new ServiceInterfacePointBuilder()
                     .setServiceInterfacePointId(new Uuid(uniArr[0])).build();
             endPointBuilder.setRole(PortRole.SYMMETRIC).setLocalId("e:" + uniArr[0])
                     .setServiceInterfacePoint(sipRef).setDirection(PortDirection.BIDIRECTIONAL)
-                    .setLayerProtocolName(layerProtocolName)
-                    .addAugmentation(EndPoint7.class,
+                    .setLayerProtocolName(layerProtocolName).addAugmentation(EndPoint7.class,
                             LegatoUtils.buildUpdateEthConnectivityEndPointAugmentation(uniArr[1]));
         }
 
@@ -274,8 +327,8 @@ public class LegatoUtils {
             InstanceIdentifier<?> evcNode) {
         final ReadTransaction read = dataBroker.newReadOnlyTransaction();
         final InstanceIdentifier<Evc> evcId = evcNode.firstIdentifierOf(Evc.class);
-        final FluentFuture<Optional<Evc>> linkFuture = read.read(store, evcId);
         try {
+            final FluentFuture<Optional<Evc>> linkFuture = read.read(store, evcId);
             return linkFuture.get();
         } catch (final InterruptedException | ExecutionException e) {
             LOG.error("Unable to read node with EVC Id {}, err: {} ", evcId, e);
@@ -353,7 +406,7 @@ public class LegatoUtils {
                     return cmpProfileFuture.get();
 
                 default:
-                    LOG.info("IN DEFAULT CASE :  NO MATCH");
+                    LOG.trace("IN DEFAULT CASE :  NO MATCH");
             }
         } catch (final InterruptedException | ExecutionException e) {
             LOG.error("Unable to read node ", e);
@@ -364,7 +417,7 @@ public class LegatoUtils {
     public static boolean deleteFromOperationalDB(InstanceIdentifier<?> nodeIdentifier,
             DataBroker dataBroker) {
 
-        LOG.info("Received a request to delete node {}", nodeIdentifier);
+        LOG.debug("Received a request to delete node {}", nodeIdentifier);
         boolean result = false;
 
         final WriteTransaction transaction = dataBroker.newWriteOnlyTransaction();
@@ -381,7 +434,7 @@ public class LegatoUtils {
 
     public static <T extends DataObject> void addToOperationalDB(T typeOfProfile,
             InstanceIdentifier<T> profilesTx, DataBroker dataBroker) {
-        LOG.info("Received a request to add node {}", profilesTx);
+        LOG.trace("Received a request to add node {}", profilesTx);
 
         WriteTransaction transaction = dataBroker.newWriteOnlyTransaction();
         transaction.merge(LogicalDatastoreType.OPERATIONAL, profilesTx, typeOfProfile);
@@ -396,25 +449,80 @@ public class LegatoUtils {
 
     public static boolean updateEvcInOperationalDB(Evc evc,
             InstanceIdentifier<SubscriberServices> nodeIdentifier, DataBroker dataBroker) {
-        LOG.info("Received a request to add node {}", nodeIdentifier);
-
+        LOG.trace("Received a request to add node {}", nodeIdentifier);
         boolean result = false;
 
+        Optional<Evc> optionalEvc =
+                LegatoUtils.readEvc(dataBroker, LogicalDatastoreType.OPERATIONAL,
+                        InstanceIdentifier.create(MefServices.class).child(CarrierEthernet.class)
+                                .child(SubscriberServices.class)
+                                .child(Evc.class, new EvcKey(new EvcIdType(evc.getEvcId()))));
+
         List<Evc> evcList = new ArrayList<Evc>();
         evcList.add(evc);
 
         final WriteTransaction transaction = dataBroker.newWriteOnlyTransaction();
-        transaction.put(LogicalDatastoreType.OPERATIONAL, nodeIdentifier,
-                new SubscriberServicesBuilder().setEvc(evcList).build());
+        // if EVC Id present in operational DB
+        if (optionalEvc.isPresent()) {
+            transaction.put(LogicalDatastoreType.OPERATIONAL, nodeIdentifier,
+                    new SubscriberServicesBuilder().setEvc(evcList).build());
+        } else {
+            transaction.merge(LogicalDatastoreType.OPERATIONAL, nodeIdentifier,
+                    new SubscriberServicesBuilder().setEvc(evcList).build());
+        }
 
         try {
             transaction.commit().get();
             result = true;
         } catch (InterruptedException | ExecutionException e) {
-            LOG.error("Unable to add node in OperationalDB() ", nodeIdentifier, e);
+            LOG.error("Unable to update node in OperationalDB() ", nodeIdentifier, e);
         }
         return result;
 
     }
 
+
+    public static List<String> validateVlanTag(EVCDao evcDao) {
+        List<String> vlanIdList = new ArrayList<String>();
+        List<String> vlanTagList = new ArrayList<String>();
+
+        for (String uniId : evcDao.getUniIdList()) {
+            vlanTagList = evcDao.getUniVlanIdList().get(uniId);
+            if (vlanIdList.size() == 0) {
+                vlanIdList = vlanTagList;
+            } else if (vlanIdList.size() != vlanTagList.size()) {
+                LOG.error("All end points should have equal number of vlan tags");
+                vlanIdList = new ArrayList<String>();
+            } else if (!vlanIdList.equals(vlanTagList)) {
+                LOG.error("All end points should have same vlan tags");
+                vlanIdList = new ArrayList<String>();
+
+                return vlanIdList;
+            }
+        }
+        if (Collections.frequency(vlanIdList, "0") == vlanIdList.size()) {
+            vlanIdList.clear();
+        }
+        return vlanIdList;
+    }
+
+
+    public static boolean removeFlowFromConfigDatastore(InstanceIdentifier<?> nodeIdentifier,
+            DataBroker dataBroker) {
+
+        LOG.trace("Removing EVC from CONFIGURATION datastore ", nodeIdentifier);
+        boolean result = false;
+
+        final WriteTransaction transaction = dataBroker.newWriteOnlyTransaction();
+        transaction.delete(LogicalDatastoreType.CONFIGURATION, nodeIdentifier);
+
+        try {
+            transaction.commit().get();
+            result = true;
+        } catch (InterruptedException | ExecutionException e) {
+            LOG.error("Unable to remove evc from CONFIGURATION datastore  ", nodeIdentifier, e);
+        }
+        return result;
+    }
+
 }
index 6f7ca546a8b64f4fd0c52c44670a1e064e27f0cf..93b44fd8c819f0dac7f44f6e3627218cbf05dc34 100755 (executable)
@@ -2,13 +2,14 @@
 <!--
  * Copyright (c) 2018 Xoriant Corporation and others. All rights reserved.
  *
 * This program and the accompanying materials are made available under the
+ * This program and the accompanying materials are made available under the
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
 -->
-<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0" xmlns:odl="http://opendaylight.org/xmlns/blueprint/v1.0.0"
-           odl:use-default-for-reference-types="true">
-
+<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0" 
+    xmlns:odl="http://opendaylight.org/xmlns/blueprint/v1.0.0" 
+    odl:use-default-for-reference-types="true">
    <reference id="dataBroker" interface="org.opendaylight.mdsal.binding.api.DataBroker" />
   
    <odl:rpc-service id="prestoConnectivityService" interface="org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev180307.TapiConnectivityService" />
                <argument ref="dataBroker" />
                <property name="prestoConnectivityService" ref="prestoConnectivityService" />
    </bean>
-   
-   <bean id="mef-sls-profile" class="org.opendaylight.unimgr.mef.legato.LegatoSlsProfileController">
-       <argument ref="dataBroker" />
-   </bean>
 
-       <bean id="mef-cos-profile" class="org.opendaylight.unimgr.mef.legato.LegatoCosProfileController">
-       <argument ref="dataBroker" />
-   </bean>
-   
-   <bean id="mef-bwp-profile" class="org.opendaylight.unimgr.mef.legato.LegatoBwpProfileController">
-       <argument ref="dataBroker" />
-   </bean>
-   
-   <bean id="mef-l2cp-eec-profile" class="org.opendaylight.unimgr.mef.legato.LegatoL2cpEecController">
-       <argument ref="dataBroker" />
-   </bean>
-   
-    <bean id="mef-l2cp-peering-profile" class="org.opendaylight.unimgr.mef.legato.LegatoL2cpPeeringController">
-       <argument ref="dataBroker" />
-   </bean>
-   
-   <bean id="mef-eec-profile" class="org.opendaylight.unimgr.mef.legato.LegatoEecProfileController">
-       <argument ref="dataBroker" />
-   </bean>
-   
-   <bean id="mef-cmp-profile" class="org.opendaylight.unimgr.mef.legato.LegatoColorMappingProfileController">
-       <argument ref="dataBroker" />
-   </bean>
-   
 </blueprint>
-
-
diff --git a/legato-api/src/test/java/org/opendaylight/unimgr/mef/legato/evc/EpLanIntegrationTest.java b/legato-api/src/test/java/org/opendaylight/unimgr/mef/legato/evc/EpLanIntegrationTest.java
new file mode 100644 (file)
index 0000000..8f04671
--- /dev/null
@@ -0,0 +1,321 @@
+/*
+ * Copyright (c) 2018 Xoriant Corporation and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.unimgr.mef.legato.evc;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.ArgumentMatchers.argThat;
+import static org.mockito.Mockito.doNothing;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Optional;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.Future;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.ArgumentMatcher;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.opendaylight.mdsal.binding.api.DataBroker;
+import org.opendaylight.mdsal.binding.api.ReadTransaction;
+import org.opendaylight.mdsal.binding.api.WriteTransaction;
+import org.opendaylight.mdsal.common.api.LogicalDatastoreType;
+import org.opendaylight.mdsal.common.api.ReadFailedException;
+import org.opendaylight.unimgr.mef.legato.dao.EVCDao;
+import org.opendaylight.unimgr.mef.legato.util.LegatoUtils;
+import org.opendaylight.unimgr.mef.legato.utils.Constants;
+import org.opendaylight.yang.gen.v1.urn.mef.yang.mef.legato.services.rev171215.MefServices;
+import org.opendaylight.yang.gen.v1.urn.mef.yang.mef.legato.services.rev171215.mef.services.CarrierEthernet;
+import org.opendaylight.yang.gen.v1.urn.mef.yang.mef.legato.services.rev171215.mef.services.carrier.ethernet.SubscriberServices;
+import org.opendaylight.yang.gen.v1.urn.mef.yang.mef.legato.services.rev171215.mef.services.carrier.ethernet.subscriber.services.Evc;
+import org.opendaylight.yang.gen.v1.urn.mef.yang.mef.legato.services.rev171215.mef.services.carrier.ethernet.subscriber.services.EvcBuilder;
+import org.opendaylight.yang.gen.v1.urn.mef.yang.mef.legato.services.rev171215.mef.services.carrier.ethernet.subscriber.services.EvcKey;
+import org.opendaylight.yang.gen.v1.urn.mef.yang.mef.legato.services.rev171215.mef.services.carrier.ethernet.subscriber.services.evc.EndPointsBuilder;
+import org.opendaylight.yang.gen.v1.urn.mef.yang.mef.legato.services.rev171215.mef.services.carrier.ethernet.subscriber.services.evc.end.points.EndPoint;
+import org.opendaylight.yang.gen.v1.urn.mef.yang.mef.legato.services.rev171215.mef.services.carrier.ethernet.subscriber.services.evc.end.points.EndPointBuilder;
+import org.opendaylight.yang.gen.v1.urn.mef.yang.mef.legato.services.rev171215.mef.services.carrier.ethernet.subscriber.services.evc.end.points.end.point.CeVlansBuilder;
+import org.opendaylight.yang.gen.v1.urn.mef.yang.mef.types.rev171215.ConnectionType;
+import org.opendaylight.yang.gen.v1.urn.mef.yang.mef.types.rev171215.EvcIdType;
+import org.opendaylight.yang.gen.v1.urn.mef.yang.mef.types.rev171215.EvcUniRoleType;
+import org.opendaylight.yang.gen.v1.urn.mef.yang.mef.types.rev171215.Identifier45;
+import org.opendaylight.yang.gen.v1.urn.mef.yang.mef.types.rev171215.MaxFrameSizeType;
+import org.opendaylight.yang.gen.v1.urn.mef.yang.mef.types.rev171215.MefServiceType;
+import org.opendaylight.yang.gen.v1.urn.mef.yang.mef.types.rev171215.VlanIdType;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev180307.CreateConnectivityServiceInput;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev180307.CreateConnectivityServiceOutput;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev180307.DeleteConnectivityServiceInput;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev180307.DeleteConnectivityServiceInputBuilder;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev180307.DeleteConnectivityServiceOutput;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev180307.TapiConnectivityService;
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.common.RpcResult;
+import org.powermock.api.mockito.PowerMockito;
+import org.powermock.api.support.membermodification.MemberMatcher;
+import org.powermock.api.support.membermodification.MemberModifier;
+import org.powermock.core.classloader.annotations.PrepareForTest;
+import org.powermock.modules.junit4.PowerMockRunner;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.google.common.util.concurrent.FluentFuture;
+import com.google.common.util.concurrent.ListenableFuture;
+
+import ch.qos.logback.classic.spi.LoggingEvent;
+import ch.qos.logback.core.Appender;
+
+
+/*
+ * @author Om.SAwasthi@Xoriant.Com
+ */
+
+@SuppressWarnings("deprecation")
+@RunWith(PowerMockRunner.class)
+@PrepareForTest({LegatoUtils.class})
+public class EpLanIntegrationTest {
+    @Mock
+    private TapiConnectivityService prestoConnectivityService;
+    @Mock
+    private DataBroker dataBroker;
+    @SuppressWarnings("rawtypes")
+    @Mock
+    private Appender mockAppender;
+    @Mock
+    private WriteTransaction transaction;
+    @Mock
+    private ReadTransaction readTxn;
+    @SuppressWarnings("rawtypes")
+    @Mock
+    private FluentFuture fluentFuture;
+    private EndPointBuilder endPointBuilder;
+    private Evc evc;
+    private EVCDao evcDao;
+    private ch.qos.logback.classic.Logger root;
+
+    @SuppressWarnings("unchecked")
+    @Before
+    public void setUp() throws Exception {
+
+        final List<VlanIdType> vlanIdTypes = new ArrayList<>();
+        vlanIdTypes.add(new VlanIdType(301));
+
+        CeVlansBuilder ceVlansBuilder = new CeVlansBuilder();
+        ceVlansBuilder.setCeVlan(vlanIdTypes);
+
+        final List<EndPoint> endPointList = new ArrayList<EndPoint>();
+        endPointBuilder = new EndPointBuilder();
+        endPointBuilder.setCeVlans(ceVlansBuilder.build());
+        endPointBuilder.setUniId(new Identifier45(Constants.UNI_ID1));
+        endPointBuilder.setRole(EvcUniRoleType.Root);
+
+        endPointList.add(endPointBuilder.build());
+        endPointBuilder = new EndPointBuilder();
+        endPointBuilder.setCeVlans(ceVlansBuilder.build());
+        endPointBuilder.setUniId(new Identifier45(Constants.UNI_ID2));
+        endPointBuilder.setRole(EvcUniRoleType.Leaf);
+
+        endPointList.add(endPointBuilder.build());
+        endPointBuilder = new EndPointBuilder();
+        endPointBuilder.setCeVlans(ceVlansBuilder.build());
+        endPointBuilder.setUniId(new Identifier45(Constants.UNI_ID3));
+        endPointBuilder.setRole(EvcUniRoleType.Leaf);
+        endPointList.add(endPointBuilder.build());
+
+        evc = (Evc) new EvcBuilder().setEvcId(new EvcIdType(Constants.EVC_ID_TYPE))
+                .setEndPoints(new EndPointsBuilder().setEndPoint(endPointList).build())
+                .setMaxFrameSize(new MaxFrameSizeType(Constants.MAXFRAME_SIZE_TYPE))
+                .setEvcId(new EvcIdType(Constants.EVC_ID_TYPE))
+                .setConnectionType(ConnectionType.MultipointToMultipoint)
+                .setSvcType(MefServiceType.Eplan).build();
+
+        root = (ch.qos.logback.classic.Logger) LoggerFactory.getLogger(Logger.ROOT_LOGGER_NAME);
+        when(mockAppender.getName()).thenReturn("MOCK");
+        root.addAppender(mockAppender);
+    }
+
+    @SuppressWarnings({"unchecked"})
+    @Test
+    public void testCreateService() throws ReadFailedException, InterruptedException, ExecutionException {
+
+        //having
+        assertNotNull(evc);
+        evcDao = LegatoUtils.parseNodes(evc);
+
+        PowerMockito.stub(PowerMockito.method(LegatoUtils.class, "parseNodes", Evc.class)).toReturn(evcDao);
+
+        assertEquals(ConnectionType.MultipointToMultipoint.getName(), evcDao.getConnectionType());
+        assertEquals(MefServiceType.Eplan.getName(), evcDao.getSvcType());
+
+        CreateConnectivityServiceInput input = LegatoUtils.buildCreateConnectivityServiceInput(
+            evcDao, String.valueOf(Constants.VLAN_ID), evc.getEndPoints().getEndPoint());
+
+        final RpcResult<CreateConnectivityServiceOutput> rpcResult = mock(RpcResult.class);
+        final ListenableFuture<RpcResult<CreateConnectivityServiceOutput>> future = mock(ListenableFuture.class);
+
+        when(future.get()).thenReturn(rpcResult);
+        when(rpcResult.isSuccessful()).thenReturn(true);
+        when(prestoConnectivityService.createConnectivityService(input)).thenReturn(future);
+
+        //when
+        Future<RpcResult<CreateConnectivityServiceOutput>> result = this.prestoConnectivityService
+            .createConnectivityService(input);
+        //then
+        assertTrue(result.get().isSuccessful());
+
+        final Optional<Evc> optEvc = mock(Optional.class);
+        when(optEvc.isPresent()).thenReturn(true);
+        when(optEvc.get()).thenReturn(evc);
+
+        final InstanceIdentifier<SubscriberServices> instanceIdentifier = InstanceIdentifier.builder(MefServices.class)
+            .child(CarrierEthernet.class).child(SubscriberServices.class).build();
+
+        when(dataBroker.newWriteOnlyTransaction()).thenReturn(transaction);
+
+        PowerMockito.stub(
+                PowerMockito.method(LegatoUtils.class,
+                        "readEvc", DataBroker.class, LogicalDatastoreType.class, InstanceIdentifier.class))
+        .toReturn(optEvc);
+
+        when(transaction.commit()).thenReturn(fluentFuture);
+
+        assertEquals(true,LegatoUtils.updateEvcInOperationalDB(evc, instanceIdentifier, dataBroker));
+        verify(transaction).put(any(LogicalDatastoreType.class), any(InstanceIdentifier.class), any(SubscriberServices.class));
+        verify(transaction).commit();
+    }
+
+    @Test
+    public void testcreateServiceBadInput() throws ReadFailedException, ExecutionException {
+
+        // having
+        assertNotNull(evc);
+        evcDao = LegatoUtils.parseNodes(evc);
+        evcDao.setSvcType(MefServiceType.Evplan.getName());
+
+        PowerMockito.stub(PowerMockito.method(LegatoUtils.class, "parseNodes", Evc.class)).toReturn(evcDao);
+
+        // then
+        assertEquals(ConnectionType.MultipointToMultipoint.getName(), evcDao.getConnectionType());
+        assertNotEquals(MefServiceType.Eplan.getName(), evcDao.getSvcType());
+
+    }
+
+    @SuppressWarnings("unchecked")
+    @Test
+    public void testUpdateService() throws InterruptedException, ExecutionException, ReadFailedException {
+
+        // having
+        assertNotNull(evc);
+        evcDao = LegatoUtils.parseNodes(evc);
+
+        PowerMockito.stub(PowerMockito.method(LegatoUtils.class, "parseNodes", Evc.class)).toReturn(evcDao);
+
+        assertEquals(ConnectionType.MultipointToMultipoint.getName(), evcDao.getConnectionType());
+        assertEquals(MefServiceType.Eplan.getName(), evcDao.getSvcType());
+        DeleteConnectivityServiceInput deleteConnectivityServiceInput = new DeleteConnectivityServiceInputBuilder()
+            .setServiceIdOrName(Constants.UUID).build();
+
+        final RpcResult<DeleteConnectivityServiceOutput> rpcResult = mock(RpcResult.class);
+        final ListenableFuture<RpcResult<DeleteConnectivityServiceOutput>> future = mock(ListenableFuture.class);
+
+        when(future.get()).thenReturn(rpcResult);
+        when(rpcResult.isSuccessful()).thenReturn(true);
+        when(prestoConnectivityService.deleteConnectivityService(deleteConnectivityServiceInput)).thenReturn(future);
+
+        // when
+        Future<RpcResult<DeleteConnectivityServiceOutput>> delResult = this.prestoConnectivityService
+            .deleteConnectivityService(deleteConnectivityServiceInput);
+
+        // then
+        assertTrue(delResult.get().isSuccessful());
+
+        this.testCreateService();
+    }
+
+    @Test
+    public void testUpdateServiceBadInput() throws InterruptedException, ExecutionException {
+
+        // having
+        assertNotNull(evc);
+        evcDao = LegatoUtils.parseNodes(evc);
+        evcDao.setSvcType(MefServiceType.Evplan.getName());
+
+        PowerMockito.stub(PowerMockito.method(LegatoUtils.class, "parseNodes", Evc.class)).toReturn(evcDao);
+
+        // then
+        assertEquals(ConnectionType.MultipointToMultipoint.getName(), evcDao.getConnectionType());
+        assertNotEquals(MefServiceType.Eplan.getName(), evcDao.getSvcType());
+    }
+
+    @SuppressWarnings({"unchecked", "rawtypes"})
+    @Test
+    public void testDeleteService() throws InterruptedException, ExecutionException {
+
+        // having
+        DeleteConnectivityServiceInput input = new DeleteConnectivityServiceInputBuilder()
+                .setServiceIdOrName(Constants.UUID).build();
+
+        final RpcResult<DeleteConnectivityServiceOutput> rpcResult = mock(RpcResult.class);
+        final ListenableFuture<RpcResult<DeleteConnectivityServiceOutput>> future = mock(ListenableFuture.class);
+
+        when(future.get()).thenReturn(rpcResult);
+        when(rpcResult.isSuccessful()).thenReturn(true);
+        when(prestoConnectivityService.deleteConnectivityService(input)).thenReturn(future);
+
+        // when
+        Future<RpcResult<DeleteConnectivityServiceOutput>> result = this.prestoConnectivityService
+            .deleteConnectivityService(input);
+
+        // then
+        assertTrue(result.get().isSuccessful());
+
+        final InstanceIdentifier<?> evcKey = InstanceIdentifier.create(MefServices.class)
+                .child(CarrierEthernet.class).child(SubscriberServices.class)
+                .child(Evc.class, new EvcKey(new EvcIdType(Constants.EVC_ID_TYPE)));
+
+        when(dataBroker.newWriteOnlyTransaction()).thenReturn(transaction);
+        doNothing().when(transaction).delete(any(LogicalDatastoreType.class), any(InstanceIdentifier.class));
+        when(transaction.commit()).thenReturn(fluentFuture);
+
+        assertEquals(true, LegatoUtils.deleteFromOperationalDB(evcKey, dataBroker));
+
+        verify(transaction).delete(any(LogicalDatastoreType.class), any(InstanceIdentifier.class));
+        verify(transaction).commit();
+        verify(mockAppender).doAppend(argThat(new ArgumentMatcher() {
+            @Override
+            public boolean matches(final Object argument) {
+                return ((LoggingEvent) argument).getFormattedMessage()
+                        .contains("Received a request to delete node");
+            }
+        }));
+
+    }
+
+    @Test
+    public void testDeleteServiceBadInput() throws InterruptedException, ExecutionException {
+
+        // having
+        String uuid = "cs:162052f6bb1:73aaf0f6";
+
+        // when
+        DeleteConnectivityServiceInput input = new DeleteConnectivityServiceInputBuilder()
+            .setServiceIdOrName(Constants.UUID).build();
+
+        // then
+        assertNotEquals(uuid, input.getServiceIdOrName());
+
+    }
+
+}
diff --git a/legato-api/src/test/java/org/opendaylight/unimgr/mef/legato/evc/EpLineIntegrationTest.java b/legato-api/src/test/java/org/opendaylight/unimgr/mef/legato/evc/EpLineIntegrationTest.java
new file mode 100644 (file)
index 0000000..9014d5b
--- /dev/null
@@ -0,0 +1,321 @@
+/*
+ * Copyright (c) 2018 Xoriant Corporation and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.unimgr.mef.legato.evc;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.ArgumentMatchers.argThat;
+import static org.mockito.Mockito.doNothing;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Optional;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.Future;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.ArgumentMatcher;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.opendaylight.mdsal.binding.api.DataBroker;
+import org.opendaylight.mdsal.binding.api.ReadTransaction;
+import org.opendaylight.mdsal.binding.api.WriteTransaction;
+import org.opendaylight.mdsal.common.api.LogicalDatastoreType;
+import org.opendaylight.mdsal.common.api.ReadFailedException;
+import org.opendaylight.unimgr.mef.legato.LegatoServiceController;
+import org.opendaylight.unimgr.mef.legato.dao.EVCDao;
+import org.opendaylight.unimgr.mef.legato.util.LegatoUtils;
+import org.opendaylight.unimgr.mef.legato.utils.Constants;
+import org.opendaylight.unimgr.mef.nrp.common.ResourceActivatorException;
+import org.opendaylight.yang.gen.v1.urn.mef.yang.mef.legato.services.rev171215.MefServices;
+import org.opendaylight.yang.gen.v1.urn.mef.yang.mef.legato.services.rev171215.mef.services.CarrierEthernet;
+import org.opendaylight.yang.gen.v1.urn.mef.yang.mef.legato.services.rev171215.mef.services.carrier.ethernet.SubscriberServices;
+import org.opendaylight.yang.gen.v1.urn.mef.yang.mef.legato.services.rev171215.mef.services.carrier.ethernet.subscriber.services.Evc;
+import org.opendaylight.yang.gen.v1.urn.mef.yang.mef.legato.services.rev171215.mef.services.carrier.ethernet.subscriber.services.EvcBuilder;
+import org.opendaylight.yang.gen.v1.urn.mef.yang.mef.legato.services.rev171215.mef.services.carrier.ethernet.subscriber.services.EvcKey;
+import org.opendaylight.yang.gen.v1.urn.mef.yang.mef.legato.services.rev171215.mef.services.carrier.ethernet.subscriber.services.evc.EndPointsBuilder;
+import org.opendaylight.yang.gen.v1.urn.mef.yang.mef.legato.services.rev171215.mef.services.carrier.ethernet.subscriber.services.evc.end.points.EndPoint;
+import org.opendaylight.yang.gen.v1.urn.mef.yang.mef.legato.services.rev171215.mef.services.carrier.ethernet.subscriber.services.evc.end.points.EndPointBuilder;
+import org.opendaylight.yang.gen.v1.urn.mef.yang.mef.legato.services.rev171215.mef.services.carrier.ethernet.subscriber.services.evc.end.points.end.point.CeVlansBuilder;
+import org.opendaylight.yang.gen.v1.urn.mef.yang.mef.types.rev171215.ConnectionType;
+import org.opendaylight.yang.gen.v1.urn.mef.yang.mef.types.rev171215.EvcIdType;
+import org.opendaylight.yang.gen.v1.urn.mef.yang.mef.types.rev171215.EvcUniRoleType;
+import org.opendaylight.yang.gen.v1.urn.mef.yang.mef.types.rev171215.Identifier45;
+import org.opendaylight.yang.gen.v1.urn.mef.yang.mef.types.rev171215.MaxFrameSizeType;
+import org.opendaylight.yang.gen.v1.urn.mef.yang.mef.types.rev171215.MefServiceType;
+import org.opendaylight.yang.gen.v1.urn.mef.yang.mef.types.rev171215.VlanIdType;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev180307.CreateConnectivityServiceInput;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev180307.CreateConnectivityServiceOutput;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev180307.DeleteConnectivityServiceInput;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev180307.DeleteConnectivityServiceInputBuilder;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev180307.DeleteConnectivityServiceOutput;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev180307.TapiConnectivityService;
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.common.RpcResult;
+import org.powermock.api.mockito.PowerMockito;
+import org.powermock.api.support.membermodification.MemberMatcher;
+import org.powermock.api.support.membermodification.MemberModifier;
+import org.powermock.core.classloader.annotations.PrepareForTest;
+import org.powermock.modules.junit4.PowerMockRunner;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.google.common.util.concurrent.FluentFuture;
+import com.google.common.util.concurrent.ListenableFuture;
+
+import ch.qos.logback.classic.spi.LoggingEvent;
+import ch.qos.logback.core.Appender;
+
+/*
+ * @author Arif.Hussain@Xoriant.Com
+ * @author Om.SAwasthi@Xoriant.Com
+ */
+
+@SuppressWarnings("deprecation")
+@RunWith(PowerMockRunner.class)
+@PrepareForTest({LegatoUtils.class})
+public class EpLineIntegrationTest {
+
+    @Mock
+    private LegatoServiceController legatoServiceController;
+    @Mock
+    private TapiConnectivityService prestoConnectivityService;
+    @Mock
+    private DataBroker dataBroker;
+    @SuppressWarnings("rawtypes")
+    @Mock
+    private Appender mockAppender;
+    @Mock
+    private WriteTransaction transaction;
+    @Mock
+    private ReadTransaction readTxn;
+    @SuppressWarnings("rawtypes")
+    @Mock
+    private FluentFuture fluentFuture;
+    private EndPointBuilder endPointBuilder;
+
+    private Evc evc;
+    private EVCDao evcDao;
+    private ch.qos.logback.classic.Logger root;
+
+    @SuppressWarnings("unchecked")
+    @Before
+    public void setUp() throws Exception {
+
+        final List<VlanIdType> vlanIdTypes = new ArrayList<>();
+        vlanIdTypes.add(new VlanIdType(301));
+
+        CeVlansBuilder ceVlansBuilder = new CeVlansBuilder();
+        ceVlansBuilder.setCeVlan(vlanIdTypes);
+
+        final List<EndPoint> endPointList = new ArrayList<EndPoint>();
+
+        endPointBuilder = new EndPointBuilder();
+        endPointBuilder.setUniId(new Identifier45(Constants.UNI_ID1));
+        endPointBuilder.setCeVlans(ceVlansBuilder.build());
+        endPointBuilder.setRole(EvcUniRoleType.Root);
+        endPointList.add(endPointBuilder.build());
+
+        endPointBuilder = new EndPointBuilder();
+        endPointBuilder.setUniId(new Identifier45(Constants.UNI_ID2));
+        endPointBuilder.setCeVlans(ceVlansBuilder.build());
+        endPointBuilder.setRole(EvcUniRoleType.Root);
+        endPointList.add(endPointBuilder.build());
+
+        evc = (Evc) new EvcBuilder().setEvcId(new EvcIdType(Constants.EVC_ID_TYPE))
+                .setMaxFrameSize(new MaxFrameSizeType(Constants.MAXFRAME_SIZE_TYPE))
+                .setEvcId(new EvcIdType(Constants.EVC_ID_TYPE)).setSvcType(MefServiceType.Epl)
+                .setConnectionType(ConnectionType.PointToPoint)
+                .setEndPoints(new EndPointsBuilder().setEndPoint(endPointList).build()).build();
+
+        root = (ch.qos.logback.classic.Logger) LoggerFactory.getLogger(Logger.ROOT_LOGGER_NAME);
+        when(mockAppender.getName()).thenReturn("MOCK");
+        root.addAppender(mockAppender);
+
+    }
+
+
+    @SuppressWarnings("unchecked")
+    @Test
+    public void testCreateService() throws InterruptedException, ExecutionException,
+            ResourceActivatorException {
+        // having
+        assertNotNull(evc);
+        evcDao = LegatoUtils.parseNodes(evc);
+
+        PowerMockito.stub(PowerMockito.method(LegatoUtils.class, "parseNodes", Evc.class)).toReturn(evcDao);
+
+        assertEquals(ConnectionType.PointToPoint.getName(), evcDao.getConnectionType());
+        assertEquals(MefServiceType.Epl.getName(), evcDao.getSvcType());
+
+        CreateConnectivityServiceInput input = LegatoUtils.buildCreateConnectivityServiceInput(evcDao,
+            String.valueOf(Constants.VLAN_ID), evc.getEndPoints().getEndPoint());
+
+        final RpcResult<CreateConnectivityServiceOutput> rpcResult = mock(RpcResult.class);
+        final ListenableFuture<RpcResult<CreateConnectivityServiceOutput>> future = mock(ListenableFuture.class);
+
+        when(future.get()).thenReturn(rpcResult);
+        when(rpcResult.isSuccessful()).thenReturn(true);
+        when(prestoConnectivityService.createConnectivityService(input)).thenReturn(future);
+
+        // when
+        Future<RpcResult<CreateConnectivityServiceOutput>> result = this.prestoConnectivityService
+            .createConnectivityService(input);
+        // then
+        assertTrue(result.get().isSuccessful());
+
+        final Optional<Evc> optEvc = mock(Optional.class);
+
+        when(optEvc.isPresent()).thenReturn(true);
+        when(optEvc.get()).thenReturn(evc);
+
+        final InstanceIdentifier<SubscriberServices> instanceIdentifier = InstanceIdentifier.builder(MefServices.class)
+            .child(CarrierEthernet.class).child(SubscriberServices.class).build();
+
+        when(dataBroker.newWriteOnlyTransaction()).thenReturn(transaction);
+
+        PowerMockito.stub(
+                PowerMockito.method(LegatoUtils.class,
+                        "readEvc", DataBroker.class, LogicalDatastoreType.class, InstanceIdentifier.class))
+        .toReturn(optEvc);
+
+        when(transaction.commit()).thenReturn(fluentFuture);
+
+        assertEquals(true,LegatoUtils.updateEvcInOperationalDB(evc, instanceIdentifier, dataBroker));
+        verify(transaction).put(any(LogicalDatastoreType.class), any(InstanceIdentifier.class), any(SubscriberServices.class));
+        verify(transaction).commit();
+    }
+
+    @Test
+    public void testcreateServiceBadInput() throws ReadFailedException, ExecutionException {
+
+        assertNotNull(evc);
+        evcDao = LegatoUtils.parseNodes(evc);
+        evcDao.setSvcType(MefServiceType.Evpl.getName());
+
+        PowerMockito.stub(PowerMockito.method(LegatoUtils.class, "parseNodes", Evc.class)).toReturn(evcDao);
+
+        // then
+        assertEquals(ConnectionType.PointToPoint.getName(), evcDao.getConnectionType());
+        assertNotEquals(MefServiceType.Epl.getName(), evcDao.getSvcType());
+
+    }
+
+    @SuppressWarnings("unchecked")
+    @Test
+    public void testUpdateService() throws InterruptedException, ExecutionException,
+                                             ResourceActivatorException {
+        // having
+        assertNotNull(evc);
+        evcDao = LegatoUtils.parseNodes(evc);
+
+        PowerMockito.stub(PowerMockito.method(LegatoUtils.class, "parseNodes", Evc.class)).toReturn(evcDao);
+
+        assertEquals(ConnectionType.PointToPoint.getName(), evcDao.getConnectionType());
+        assertEquals(MefServiceType.Epl.getName(), evcDao.getSvcType());
+        DeleteConnectivityServiceInput deleteConnectivityServiceInput = new DeleteConnectivityServiceInputBuilder()
+            .setServiceIdOrName(Constants.UUID).build();
+
+        final RpcResult<DeleteConnectivityServiceOutput> rpcResult = mock(RpcResult.class);
+        final ListenableFuture<RpcResult<DeleteConnectivityServiceOutput>> future = mock(ListenableFuture.class);
+
+        when(future.get()).thenReturn(rpcResult);
+        when(rpcResult.isSuccessful()).thenReturn(true);
+        when(prestoConnectivityService.deleteConnectivityService(deleteConnectivityServiceInput)).thenReturn(future);
+
+        // when
+        Future<RpcResult<DeleteConnectivityServiceOutput>> result = this.prestoConnectivityService
+            .deleteConnectivityService(deleteConnectivityServiceInput);
+
+        // then
+        assertTrue(result.get().isSuccessful());
+
+        this.testCreateService();
+    }
+
+    @Test
+    public void testUpdateServiceBadInput() throws InterruptedException, ExecutionException {
+
+        assertNotNull(evc);
+        evcDao = LegatoUtils.parseNodes(evc);
+        evcDao.setSvcType(MefServiceType.Evpl.getName());
+
+        PowerMockito.stub(PowerMockito.method(LegatoUtils.class, "parseNodes", Evc.class)).toReturn(evcDao);
+
+        // then
+        assertEquals(ConnectionType.PointToPoint.getName(), evcDao.getConnectionType());
+        assertNotEquals(MefServiceType.Epl.getName(), evcDao.getSvcType());
+    }
+
+    @SuppressWarnings({"unchecked", "rawtypes"})
+    @Test
+    public void testDeleteService() throws InterruptedException, ExecutionException {
+        // having
+        DeleteConnectivityServiceInput input = new DeleteConnectivityServiceInputBuilder()
+                .setServiceIdOrName(Constants.UUID).build();
+
+        final RpcResult<DeleteConnectivityServiceOutput> rpcResult = mock(RpcResult.class);
+        final ListenableFuture<RpcResult<DeleteConnectivityServiceOutput>> future = mock(ListenableFuture.class);
+
+        when(future.get()).thenReturn(rpcResult);
+        when(rpcResult.isSuccessful()).thenReturn(true);
+        when(prestoConnectivityService.deleteConnectivityService(input)).thenReturn(future);
+
+        // when
+        Future<RpcResult<DeleteConnectivityServiceOutput>> result = this.prestoConnectivityService
+            .deleteConnectivityService(input);
+
+        // then
+        assertTrue(result.get().isSuccessful());
+
+        final InstanceIdentifier<?> evcKey = InstanceIdentifier.create(MefServices.class)
+                .child(CarrierEthernet.class).child(SubscriberServices.class)
+                .child(Evc.class, new EvcKey(new EvcIdType(Constants.EVC_ID_TYPE)));
+
+        when(dataBroker.newWriteOnlyTransaction()).thenReturn(transaction);
+        doNothing().when(transaction).delete(any(LogicalDatastoreType.class), any(InstanceIdentifier.class));
+        when(transaction.commit()).thenReturn(fluentFuture);
+
+        assertEquals(true, LegatoUtils.deleteFromOperationalDB(evcKey, dataBroker));
+
+        verify(transaction).delete(any(LogicalDatastoreType.class), any(InstanceIdentifier.class));
+        verify(transaction).commit();
+        verify(mockAppender).doAppend(argThat(new ArgumentMatcher() {
+            @Override
+            public boolean matches(final Object argument) {
+                return ((LoggingEvent) argument).getFormattedMessage()
+                        .contains("Received a request to delete node");
+            }
+        }));
+    }
+
+    @Test
+    public void testDeleteServiceBadInput() throws InterruptedException, ExecutionException {
+
+        // having
+        String uuid = "cs:162052f6bb1:73aaf0f6";
+
+        // when
+        DeleteConnectivityServiceInput input = new DeleteConnectivityServiceInputBuilder()
+            .setServiceIdOrName(Constants.UUID).build();
+
+        // then
+        assertNotEquals(uuid, input.getServiceIdOrName());
+
+    }
+
+}
diff --git a/legato-api/src/test/java/org/opendaylight/unimgr/mef/legato/evc/EpTreeIntegrationTest.java b/legato-api/src/test/java/org/opendaylight/unimgr/mef/legato/evc/EpTreeIntegrationTest.java
new file mode 100644 (file)
index 0000000..858920b
--- /dev/null
@@ -0,0 +1,319 @@
+/*
+ * Copyright (c) 2018 Xoriant Corporation and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.unimgr.mef.legato.evc;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.ArgumentMatchers.argThat;
+import static org.mockito.Mockito.doNothing;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Optional;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.Future;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.ArgumentMatcher;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.opendaylight.mdsal.binding.api.DataBroker;
+import org.opendaylight.mdsal.binding.api.ReadTransaction;
+import org.opendaylight.mdsal.binding.api.WriteTransaction;
+import org.opendaylight.mdsal.common.api.LogicalDatastoreType;
+import org.opendaylight.mdsal.common.api.ReadFailedException;
+import org.opendaylight.unimgr.mef.legato.LegatoServiceController;
+import org.opendaylight.unimgr.mef.legato.dao.EVCDao;
+import org.opendaylight.unimgr.mef.legato.util.LegatoUtils;
+import org.opendaylight.unimgr.mef.legato.utils.Constants;
+import org.opendaylight.yang.gen.v1.urn.mef.yang.mef.legato.services.rev171215.MefServices;
+import org.opendaylight.yang.gen.v1.urn.mef.yang.mef.legato.services.rev171215.mef.services.CarrierEthernet;
+import org.opendaylight.yang.gen.v1.urn.mef.yang.mef.legato.services.rev171215.mef.services.carrier.ethernet.SubscriberServices;
+import org.opendaylight.yang.gen.v1.urn.mef.yang.mef.legato.services.rev171215.mef.services.carrier.ethernet.subscriber.services.Evc;
+import org.opendaylight.yang.gen.v1.urn.mef.yang.mef.legato.services.rev171215.mef.services.carrier.ethernet.subscriber.services.EvcBuilder;
+import org.opendaylight.yang.gen.v1.urn.mef.yang.mef.legato.services.rev171215.mef.services.carrier.ethernet.subscriber.services.EvcKey;
+import org.opendaylight.yang.gen.v1.urn.mef.yang.mef.legato.services.rev171215.mef.services.carrier.ethernet.subscriber.services.evc.EndPointsBuilder;
+import org.opendaylight.yang.gen.v1.urn.mef.yang.mef.legato.services.rev171215.mef.services.carrier.ethernet.subscriber.services.evc.end.points.EndPoint;
+import org.opendaylight.yang.gen.v1.urn.mef.yang.mef.legato.services.rev171215.mef.services.carrier.ethernet.subscriber.services.evc.end.points.EndPointBuilder;
+import org.opendaylight.yang.gen.v1.urn.mef.yang.mef.legato.services.rev171215.mef.services.carrier.ethernet.subscriber.services.evc.end.points.end.point.CeVlansBuilder;
+import org.opendaylight.yang.gen.v1.urn.mef.yang.mef.types.rev171215.ConnectionType;
+import org.opendaylight.yang.gen.v1.urn.mef.yang.mef.types.rev171215.EvcIdType;
+import org.opendaylight.yang.gen.v1.urn.mef.yang.mef.types.rev171215.EvcUniRoleType;
+import org.opendaylight.yang.gen.v1.urn.mef.yang.mef.types.rev171215.Identifier45;
+import org.opendaylight.yang.gen.v1.urn.mef.yang.mef.types.rev171215.MaxFrameSizeType;
+import org.opendaylight.yang.gen.v1.urn.mef.yang.mef.types.rev171215.MefServiceType;
+import org.opendaylight.yang.gen.v1.urn.mef.yang.mef.types.rev171215.VlanIdType;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev180307.CreateConnectivityServiceInput;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev180307.CreateConnectivityServiceOutput;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev180307.DeleteConnectivityServiceInput;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev180307.DeleteConnectivityServiceInputBuilder;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev180307.DeleteConnectivityServiceOutput;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev180307.TapiConnectivityService;
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.common.RpcResult;
+import org.powermock.api.mockito.PowerMockito;
+import org.powermock.api.support.membermodification.MemberMatcher;
+import org.powermock.api.support.membermodification.MemberModifier;
+import org.powermock.core.classloader.annotations.PrepareForTest;
+import org.powermock.modules.junit4.PowerMockRunner;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.google.common.util.concurrent.FluentFuture;
+import com.google.common.util.concurrent.ListenableFuture;
+
+import ch.qos.logback.classic.spi.LoggingEvent;
+import ch.qos.logback.core.Appender;
+
+/*
+ * @author OmS.awasthi@Xoriant.Com
+ */
+
+@SuppressWarnings("deprecation")
+@RunWith(PowerMockRunner.class)
+@PrepareForTest({LegatoUtils.class})
+public class EpTreeIntegrationTest {
+
+    @Mock
+    private LegatoServiceController legatoServiceController;
+    @Mock
+    private TapiConnectivityService prestoConnectivityService;
+    @Mock
+    private DataBroker dataBroker;
+    @SuppressWarnings("rawtypes")
+    @Mock
+    private Appender mockAppender;
+    @Mock
+    private WriteTransaction transaction;
+    @Mock
+    private ReadTransaction readTxn;
+    @SuppressWarnings("rawtypes")
+    @Mock
+    private FluentFuture fluentFuture;
+    private EndPointBuilder endPointBuilder;
+    private Evc evc;
+    private EVCDao evcDao;
+    private ch.qos.logback.classic.Logger root;
+
+    @SuppressWarnings("unchecked")
+    @Before
+    public void setUp() throws Exception {
+
+        final List<VlanIdType> vlanIdTypes = new ArrayList<>();
+        vlanIdTypes.add(new VlanIdType(301));
+
+        CeVlansBuilder ceVlansBuilder = new CeVlansBuilder();
+        ceVlansBuilder.setCeVlan(vlanIdTypes);
+
+        final List<EndPoint> endPointList = new ArrayList<EndPoint>();
+        endPointBuilder = new EndPointBuilder();
+        endPointBuilder.setUniId(new Identifier45(Constants.UNI_ID1));
+        endPointBuilder.setCeVlans(ceVlansBuilder.build());
+        endPointBuilder.setRole(EvcUniRoleType.Root);
+        endPointList.add(endPointBuilder.build());
+
+        endPointBuilder = new EndPointBuilder();
+        endPointBuilder.setUniId(new Identifier45(Constants.UNI_ID2));
+        endPointBuilder.setCeVlans(ceVlansBuilder.build());
+        endPointBuilder.setRole(EvcUniRoleType.Leaf);
+        endPointList.add(endPointBuilder.build());
+
+        endPointBuilder = new EndPointBuilder();
+        endPointBuilder.setUniId(new Identifier45(Constants.UNI_ID3));
+        endPointBuilder.setCeVlans(ceVlansBuilder.build());
+        endPointBuilder.setRole(EvcUniRoleType.Leaf);
+        endPointList.add(endPointBuilder.build());
+
+        evc = (Evc) new EvcBuilder().setEvcId(new EvcIdType(Constants.EVC_ID_TYPE))
+                .setEndPoints(new EndPointsBuilder().setEndPoint(endPointList).build())
+                .setMaxFrameSize(new MaxFrameSizeType(Constants.MAXFRAME_SIZE_TYPE))
+                .setEvcId(new EvcIdType(Constants.EVC_ID_TYPE))
+                .setConnectionType(ConnectionType.RootedMultipoint)
+                .setSvcType(MefServiceType.Eptree).build();
+
+        root = (ch.qos.logback.classic.Logger) LoggerFactory.getLogger(Logger.ROOT_LOGGER_NAME);
+        when(mockAppender.getName()).thenReturn("MOCK");
+        root.addAppender(mockAppender);
+    }
+
+    @SuppressWarnings("unchecked")
+    @Test
+    public void testCreateService() throws ReadFailedException, InterruptedException, ExecutionException {
+
+        assertNotNull(evc);
+        evcDao = LegatoUtils.parseNodes(evc);
+
+        PowerMockito.stub(PowerMockito.method(LegatoUtils.class, "parseNodes", Evc.class)).toReturn(evcDao);
+
+        assertEquals(ConnectionType.RootedMultipoint.getName(), evcDao.getConnectionType());
+        assertEquals(MefServiceType.Eptree.getName(), evcDao.getSvcType());
+
+        CreateConnectivityServiceInput input = LegatoUtils.buildCreateConnectivityServiceInput(evcDao,
+            String.valueOf(Constants.VLAN_ID), evc.getEndPoints().getEndPoint());
+
+        final RpcResult<CreateConnectivityServiceOutput> rpcResult = mock(RpcResult.class);
+        final ListenableFuture<RpcResult<CreateConnectivityServiceOutput>> future = mock(ListenableFuture.class);
+
+        when(future.get()).thenReturn(rpcResult);
+        when(rpcResult.isSuccessful()).thenReturn(true);
+        when(prestoConnectivityService.createConnectivityService(input)).thenReturn(future);
+
+        // when
+        Future<RpcResult<CreateConnectivityServiceOutput>> result = this.prestoConnectivityService
+            .createConnectivityService(input);
+        // then
+        assertTrue(result.get().isSuccessful());
+
+        final Optional<Evc> optEvc = mock(Optional.class);
+        when(optEvc.isPresent()).thenReturn(true);
+        when(optEvc.get()).thenReturn(evc);
+
+        final InstanceIdentifier<SubscriberServices> instanceIdentifier = InstanceIdentifier.builder(MefServices.class)
+            .child(CarrierEthernet.class).child(SubscriberServices.class).build();
+
+        when(dataBroker.newWriteOnlyTransaction()).thenReturn(transaction);
+
+        PowerMockito.stub(
+                PowerMockito.method(LegatoUtils.class,
+                        "readEvc", DataBroker.class, LogicalDatastoreType.class, InstanceIdentifier.class))
+        .toReturn(optEvc);
+
+        when(transaction.commit()).thenReturn(fluentFuture);
+
+        assertEquals(true,LegatoUtils.updateEvcInOperationalDB(evc, instanceIdentifier, dataBroker));
+        verify(transaction).put(any(LogicalDatastoreType.class), any(InstanceIdentifier.class), any(SubscriberServices.class));
+        verify(transaction).commit();
+    }
+
+    @Test
+    public void createEvcfalse() throws ReadFailedException, ExecutionException {
+
+        assertNotNull(evc);
+        evcDao = LegatoUtils.parseNodes(evc);
+        evcDao.setSvcType(MefServiceType.Evptree.getName());
+
+        PowerMockito.stub(PowerMockito.method(LegatoUtils.class, "parseNodes", Evc.class)).toReturn(evcDao);
+
+        // then
+        assertEquals(ConnectionType.RootedMultipoint.getName(), evcDao.getConnectionType());
+        assertNotEquals(MefServiceType.Eptree.getName(), evcDao.getSvcType());
+
+    }
+
+    @SuppressWarnings("unchecked")
+    @Test
+    public void updateEvc() throws InterruptedException, ExecutionException, ReadFailedException {
+
+        // having
+        assertNotNull(evc);
+        evcDao = LegatoUtils.parseNodes(evc);
+
+        PowerMockito.stub(PowerMockito.method(LegatoUtils.class, "parseNodes", Evc.class)).toReturn(evcDao);
+
+        assertEquals(ConnectionType.RootedMultipoint.getName(), evcDao.getConnectionType());
+        assertEquals(MefServiceType.Eptree.getName(), evcDao.getSvcType());
+        DeleteConnectivityServiceInput deleteConnectivityServiceInput = new DeleteConnectivityServiceInputBuilder()
+            .setServiceIdOrName(Constants.UUID).build();
+
+        final RpcResult<DeleteConnectivityServiceOutput> rpcResult = mock(RpcResult.class);
+        final ListenableFuture<RpcResult<DeleteConnectivityServiceOutput>> future = mock(ListenableFuture.class);
+
+        when(future.get()).thenReturn(rpcResult);
+        when(rpcResult.isSuccessful()).thenReturn(true);
+        when(prestoConnectivityService.deleteConnectivityService(deleteConnectivityServiceInput)).thenReturn(future);
+
+        // when
+        Future<RpcResult<DeleteConnectivityServiceOutput>> result = this.prestoConnectivityService
+            .deleteConnectivityService(deleteConnectivityServiceInput);
+
+        // then
+        assertTrue(result.get().isSuccessful());
+
+        this.testCreateService();
+    }
+
+    @Test
+    public void testUpdateServiceBadInput() throws InterruptedException, ExecutionException {
+
+        assertNotNull(evc);
+        evcDao = LegatoUtils.parseNodes(evc);
+        evcDao.setSvcType(MefServiceType.Evptree.getName());
+
+        PowerMockito.stub(PowerMockito.method(LegatoUtils.class, "parseNodes", Evc.class)).toReturn(evcDao);
+
+        // then
+        assertEquals(ConnectionType.RootedMultipoint.getName(), evcDao.getConnectionType());
+        assertNotEquals(MefServiceType.Eptree.getName(), evcDao.getSvcType());
+    }
+
+    @SuppressWarnings({"unchecked", "rawtypes"})
+    @Test
+    public void testDeleteService() throws InterruptedException, ExecutionException {
+        // having
+        DeleteConnectivityServiceInput input = new DeleteConnectivityServiceInputBuilder()
+                .setServiceIdOrName(Constants.UUID).build();
+
+        final RpcResult<DeleteConnectivityServiceOutput> rpcResult = mock(RpcResult.class);
+        final ListenableFuture<RpcResult<DeleteConnectivityServiceOutput>> future = mock(ListenableFuture.class);
+
+        when(future.get()).thenReturn(rpcResult);
+        when(rpcResult.isSuccessful()).thenReturn(true);
+        when(prestoConnectivityService.deleteConnectivityService(input)).thenReturn(future);
+
+        // when
+        Future<RpcResult<DeleteConnectivityServiceOutput>> result = this.prestoConnectivityService
+            .deleteConnectivityService(input);
+
+        // then
+        assertTrue(result.get().isSuccessful());
+
+        final InstanceIdentifier<?> evcKey = InstanceIdentifier.create(MefServices.class)
+                .child(CarrierEthernet.class).child(SubscriberServices.class)
+                .child(Evc.class, new EvcKey(new EvcIdType(Constants.EVC_ID_TYPE)));
+
+        when(dataBroker.newWriteOnlyTransaction()).thenReturn(transaction);
+        doNothing().when(transaction).delete(any(LogicalDatastoreType.class), any(InstanceIdentifier.class));
+        when(transaction.commit()).thenReturn(fluentFuture);
+
+        assertEquals(true, LegatoUtils.deleteFromOperationalDB(evcKey, dataBroker));
+
+        verify(transaction).delete(any(LogicalDatastoreType.class), any(InstanceIdentifier.class));
+        verify(transaction).commit();
+        verify(mockAppender).doAppend(argThat(new ArgumentMatcher() {
+            @Override
+            public boolean matches(final Object argument) {
+                return ((LoggingEvent) argument).getFormattedMessage().contains("Received a request to delete node");
+            }
+        }));
+    }
+
+    @Test
+    public void testDeleteServiceBadInput() throws InterruptedException, ExecutionException {
+
+        // having
+        String uuid = "cs:162052f6bb1:73aaf0f6";
+
+        // when
+        DeleteConnectivityServiceInput input = new DeleteConnectivityServiceInputBuilder()
+                .setServiceIdOrName(Constants.UUID).build();
+
+        // then
+        assertNotEquals(uuid, input.getServiceIdOrName());
+
+    }
+
+}
index 343211f7772ab5a54a316d1587d11080c463b639..b6a3c0fabc3cbf3a82c74ce307e2ff77c9f8ebb7 100644 (file)
@@ -7,6 +7,8 @@
  */
 
 package org.opendaylight.unimgr.mef.legato.evc;
+
+
 import static org.mockito.ArgumentMatchers.any;
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.times;
@@ -45,10 +47,11 @@ import org.powermock.modules.junit4.PowerMockRunner;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-/**
+
+/*
  * @author Arif.Hussain@Xoriant.Com
- *
  */
+
 @RunWith(PowerMockRunner.class)
 @PrepareForTest(LegatoUtils.class)
 public class EvcDataTreeChangeListenerTest {
@@ -98,7 +101,8 @@ public class EvcDataTreeChangeListenerTest {
             }
 
             @Override
-            public <C extends Identifiable<K> & ChildOf<? super Evc>, K extends Identifier<C>> DataObjectModification<C> getModifiedChildListItem(
+            public <C extends Identifiable<K> & ChildOf<? super Evc>, K extends
+                Identifier<C>> DataObjectModification<C> getModifiedChildListItem(
                     Class<C> arg0, K arg1) {
                 // TODO Auto-generated method stub
                 return null;
@@ -190,7 +194,7 @@ public class EvcDataTreeChangeListenerTest {
             }
         };
 
-            return modifiedEvc;
+        return modifiedEvc;
     }
 
-}
\ No newline at end of file
+}
diff --git a/legato-api/src/test/java/org/opendaylight/unimgr/mef/legato/evc/EvcIntegrationTest.java b/legato-api/src/test/java/org/opendaylight/unimgr/mef/legato/evc/EvcIntegrationTest.java
deleted file mode 100644 (file)
index 42440e8..0000000
+++ /dev/null
@@ -1,305 +0,0 @@
-/*
- * Copyright (c) 2018 Xoriant Corporation and others. All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-
-package org.opendaylight.unimgr.mef.legato.evc;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-import static org.mockito.ArgumentMatchers.any;
-import static org.mockito.ArgumentMatchers.argThat;
-import static org.mockito.Mockito.doNothing;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.when;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Optional;
-import java.util.concurrent.ExecutionException;
-import java.util.concurrent.Future;
-
-import org.junit.Before;
-import org.junit.Ignore;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.mockito.ArgumentMatcher;
-import org.mockito.Mock;
-import org.mockito.Mockito;
-import org.opendaylight.mdsal.binding.api.DataBroker;
-import org.opendaylight.mdsal.binding.api.ReadTransaction;
-import org.opendaylight.mdsal.binding.api.WriteTransaction;
-import org.opendaylight.mdsal.common.api.LogicalDatastoreType;
-import org.opendaylight.unimgr.mef.legato.LegatoServiceController;
-import org.opendaylight.unimgr.mef.legato.dao.EVCDao;
-import org.opendaylight.unimgr.mef.legato.util.LegatoUtils;
-import org.opendaylight.unimgr.mef.legato.utils.Constants;
-import org.opendaylight.unimgr.mef.nrp.common.ResourceActivatorException;
-import org.opendaylight.yang.gen.v1.urn.mef.yang.mef.legato.services.rev171215.MefServices;
-import org.opendaylight.yang.gen.v1.urn.mef.yang.mef.legato.services.rev171215.mef.services.CarrierEthernet;
-import org.opendaylight.yang.gen.v1.urn.mef.yang.mef.legato.services.rev171215.mef.services.carrier.ethernet.SubscriberServices;
-import org.opendaylight.yang.gen.v1.urn.mef.yang.mef.legato.services.rev171215.mef.services.carrier.ethernet.subscriber.services.Evc;
-import org.opendaylight.yang.gen.v1.urn.mef.yang.mef.legato.services.rev171215.mef.services.carrier.ethernet.subscriber.services.EvcBuilder;
-import org.opendaylight.yang.gen.v1.urn.mef.yang.mef.legato.services.rev171215.mef.services.carrier.ethernet.subscriber.services.EvcKey;
-import org.opendaylight.yang.gen.v1.urn.mef.yang.mef.legato.services.rev171215.mef.services.carrier.ethernet.subscriber.services.evc.CosNamesBuilder;
-import org.opendaylight.yang.gen.v1.urn.mef.yang.mef.legato.services.rev171215.mef.services.carrier.ethernet.subscriber.services.evc.EndPointsBuilder;
-import org.opendaylight.yang.gen.v1.urn.mef.yang.mef.legato.services.rev171215.mef.services.carrier.ethernet.subscriber.services.evc.cos.names.CosName;
-import org.opendaylight.yang.gen.v1.urn.mef.yang.mef.legato.services.rev171215.mef.services.carrier.ethernet.subscriber.services.evc.cos.names.CosNameBuilder;
-import org.opendaylight.yang.gen.v1.urn.mef.yang.mef.legato.services.rev171215.mef.services.carrier.ethernet.subscriber.services.evc.cos.names.CosNameKey;
-import org.opendaylight.yang.gen.v1.urn.mef.yang.mef.legato.services.rev171215.mef.services.carrier.ethernet.subscriber.services.evc.end.points.EndPoint;
-import org.opendaylight.yang.gen.v1.urn.mef.yang.mef.legato.services.rev171215.mef.services.carrier.ethernet.subscriber.services.evc.end.points.EndPointBuilder;
-import org.opendaylight.yang.gen.v1.urn.mef.yang.mef.legato.services.rev171215.mef.services.carrier.ethernet.subscriber.services.evc.end.points.end.point.CeVlansBuilder;
-import org.opendaylight.yang.gen.v1.urn.mef.yang.mef.types.rev171215.ConnectionType;
-import org.opendaylight.yang.gen.v1.urn.mef.yang.mef.types.rev171215.EvcIdType;
-import org.opendaylight.yang.gen.v1.urn.mef.yang.mef.types.rev171215.Identifier1024;
-import org.opendaylight.yang.gen.v1.urn.mef.yang.mef.types.rev171215.Identifier45;
-import org.opendaylight.yang.gen.v1.urn.mef.yang.mef.types.rev171215.MaxFrameSizeType;
-import org.opendaylight.yang.gen.v1.urn.mef.yang.mef.types.rev171215.MefServiceType;
-import org.opendaylight.yang.gen.v1.urn.mef.yang.mef.types.rev171215.VlanIdType;
-import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev180307.CreateConnectivityServiceOutput;
-import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev180307.DeleteConnectivityServiceInput;
-import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev180307.DeleteConnectivityServiceInputBuilder;
-import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev180307.TapiConnectivityService;
-import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev180307.UpdateConnectivityServiceInput;
-import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev180307.UpdateConnectivityServiceOutput;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import org.opendaylight.yangtools.yang.common.RpcResult;
-import org.powermock.api.mockito.PowerMockito;
-import org.powermock.api.support.membermodification.MemberMatcher;
-import org.powermock.api.support.membermodification.MemberModifier;
-import org.powermock.core.classloader.annotations.PrepareForTest;
-import org.powermock.modules.junit4.PowerMockRunner;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import com.google.common.util.concurrent.FluentFuture;
-
-import ch.qos.logback.classic.spi.LoggingEvent;
-import ch.qos.logback.core.Appender;
-
-/**
- * @author Arif.Hussain@Xoriant.Com
- *
- */
-@RunWith(PowerMockRunner.class)
-@PrepareForTest({LogicalDatastoreType.class, LegatoUtils.class, Optional.class})
-public class EvcIntegrationTest {
-
-    @Mock private LegatoServiceController legatoServiceController;
-    @Mock private TapiConnectivityService prestoConnectivityService;
-    @Mock private DataBroker dataBroker;
-    @SuppressWarnings("rawtypes")
-    @Mock private Appender mockAppender;
-    @Mock private WriteTransaction transaction;
-    @Mock private ReadTransaction readTxn;
-    @SuppressWarnings("rawtypes")
-    @Mock private FluentFuture checkedFuture;
-    private EndPointBuilder endPointBuilder1;
-    private EndPointBuilder endPointBuilder2;
-    private Evc evc;
-    private ch.qos.logback.classic.Logger root;
-
-
-    @SuppressWarnings("unchecked")
-    @Before
-    public void setUp() throws Exception {
-        prestoConnectivityService =
-                PowerMockito.mock(TapiConnectivityService.class, Mockito.CALLS_REAL_METHODS);
-        legatoServiceController =
-                PowerMockito.mock(LegatoServiceController.class, Mockito.CALLS_REAL_METHODS);
-        PowerMockito.mockStatic(LegatoUtils.class, Mockito.CALLS_REAL_METHODS);
-
-        MemberModifier.field(LegatoServiceController.class, "dataBroker")
-                .set(legatoServiceController, dataBroker);
-
-        CosNameBuilder builder = new CosNameBuilder();
-        builder.setName(new Identifier1024(Constants.COSNAME));
-        builder.withKey(new CosNameKey(new Identifier1024(Constants.COSNAME)));
-
-        final List<CosName> cosNameList = new ArrayList<CosName>();
-        cosNameList.add(builder.build());
-
-        CosNamesBuilder cosNamesBuilder = new CosNamesBuilder();
-        cosNamesBuilder.setCosName(cosNameList);
-
-        final List<VlanIdType> vlanIdTypes = new ArrayList<>();
-        vlanIdTypes.add(new VlanIdType(Constants.VLAN_ID_TYPE));
-
-        CeVlansBuilder ceVlansBuilder = new CeVlansBuilder();
-        ceVlansBuilder.setCeVlan(vlanIdTypes);
-
-        endPointBuilder1 = new EndPointBuilder();
-        endPointBuilder1.setCeVlans(ceVlansBuilder.build());
-        endPointBuilder1.setUniId(new Identifier45(Constants.UNI_ID1));
-
-        endPointBuilder2 = new EndPointBuilder();
-        endPointBuilder2.setCeVlans(ceVlansBuilder.build());
-        endPointBuilder2.setUniId(new Identifier45(Constants.UNI_ID2));
-
-        final List<EndPoint> endPointList = new ArrayList<EndPoint>();
-        endPointList.add(endPointBuilder1.build());
-        endPointList.add(endPointBuilder2.build());
-
-        evc = (Evc) new EvcBuilder().withKey(new EvcKey(new EvcIdType(Constants.EVC_ID_TYPE)))
-                .setMaxFrameSize(new MaxFrameSizeType(Constants.MAXFRAME_SIZE_TYPE))
-                .setEvcId(new EvcIdType(Constants.EVC_ID_TYPE))
-                .setSvcType(MefServiceType.Epl)
-                .setConnectionType(ConnectionType.PointToPoint).setCosNames(cosNamesBuilder.build())
-                .setEndPoints(new EndPointsBuilder().setEndPoint(endPointList).build()).build();
-
-        root = (ch.qos.logback.classic.Logger) LoggerFactory.getLogger(Logger.ROOT_LOGGER_NAME);
-        when(mockAppender.getName()).thenReturn("MOCK");
-        root.addAppender(mockAppender);
-
-    }
-
-
-    @SuppressWarnings("unchecked")
-    @Test
-    public void createEvc() throws InterruptedException, ExecutionException, ResourceActivatorException {
-
-        try {
-            assertNotNull(evc);
-            final EVCDao evcDao = LegatoUtils.parseNodes(evc);
-            Future<RpcResult<CreateConnectivityServiceOutput>> result =
-                    this.prestoConnectivityService.createConnectivityService(
-                            LegatoUtils.buildCreateConnectivityServiceInput(evcDao));
-            assertTrue(result.get().isSuccessful());
-
-            final InstanceIdentifier<?> evcKey = InstanceIdentifier.create(MefServices.class)
-                    .child(CarrierEthernet.class).child(SubscriberServices.class)
-                    .child(Evc.class, new EvcKey(new EvcIdType(evc.getEvcId())));
-
-            final Optional<Evc> optEvc = PowerMockito.mock(Optional.class);
-            when(optEvc.isPresent()).thenReturn(true);
-            when(optEvc.get()).thenReturn(evc);
-            MemberModifier.suppress(MemberMatcher.method(LegatoUtils.class, Constants.READ_EVC,
-                    DataBroker.class, LogicalDatastoreType.class, InstanceIdentifier.class));
-            when(LegatoUtils.readEvc(any(DataBroker.class), any(LogicalDatastoreType.class),
-                    evcKey)).thenReturn(optEvc);
-
-            final InstanceIdentifier<SubscriberServices> instanceIdentifier =
-                    InstanceIdentifier.builder(MefServices.class).child(CarrierEthernet.class)
-                            .child(SubscriberServices.class).build();
-
-            doNothing().when(transaction).put(any(LogicalDatastoreType.class),
-                    any(InstanceIdentifier.class), any(Evc.class));
-            when(dataBroker.newWriteOnlyTransaction()).thenReturn(transaction);
-            assertEquals(true, LegatoUtils.updateEvcInOperationalDB(evc, instanceIdentifier, dataBroker));
-            verify(transaction).put(any(LogicalDatastoreType.class), any(InstanceIdentifier.class),
-                    any(Evc.class));
-            verify(transaction).commit();
-
-        } catch (Exception ex) {
-        }
-
-    }
-
-
-    @SuppressWarnings("unchecked")
-    @Test
-    @Ignore
-    public void updateEvc() throws InterruptedException, ExecutionException {
-
-        assertNotNull(evc);
-        final EVCDao evcDao = LegatoUtils.parseNodes(evc);
-        assertEquals(true,
-                callUpdateConnectionService(LegatoUtils.buildUpdateConnectivityServiceInput(evcDao,
-                        evcDao.getUniList().get(0), Constants.UUID)));
-
-        final InstanceIdentifier<?> evcKey = InstanceIdentifier.create(MefServices.class)
-                .child(CarrierEthernet.class).child(SubscriberServices.class)
-                .child(Evc.class, new EvcKey(new EvcIdType(evc.getEvcId())));
-
-        MemberModifier.suppress(MemberMatcher.method(LegatoUtils.class, Constants.READ_EVC,
-                DataBroker.class, LogicalDatastoreType.class, InstanceIdentifier.class));
-        final Optional<Evc> optEvc = PowerMockito.mock(Optional.class);
-        when(LegatoUtils.readEvc(any(DataBroker.class), any(LogicalDatastoreType.class),
-                any(InstanceIdentifier.class))).thenReturn(optEvc);
-        when(optEvc.isPresent()).thenReturn(true);
-        when(optEvc.get()).thenReturn(evc);
-
-        when(dataBroker.newWriteOnlyTransaction()).thenReturn(transaction);
-        doNothing().when(transaction).delete(any(LogicalDatastoreType.class),
-                any(InstanceIdentifier.class));
-        when(transaction.commit()).thenReturn(checkedFuture);
-        assertEquals(true, LegatoUtils.deleteFromOperationalDB(evcKey, dataBroker));
-        verify(transaction).delete(any(LogicalDatastoreType.class), any(InstanceIdentifier.class));
-        verify(transaction).commit();
-
-        final InstanceIdentifier<SubscriberServices> instanceIdentifier =
-                InstanceIdentifier.builder(MefServices.class).child(CarrierEthernet.class)
-                        .child(SubscriberServices.class).build();
-
-        WriteTransaction transaction2 = Mockito.mock(WriteTransaction.class);
-        when(dataBroker.newWriteOnlyTransaction()).thenReturn(transaction2);
-        doNothing().when(transaction2).put(any(LogicalDatastoreType.class),
-                any(InstanceIdentifier.class), any(Evc.class));
-        when(transaction2.commit()).thenReturn(checkedFuture);
-        assertEquals(true, LegatoUtils.updateEvcInOperationalDB(evc, instanceIdentifier, dataBroker));
-        verify(transaction2).put(any(LogicalDatastoreType.class), any(InstanceIdentifier.class),
-                any(Evc.class));
-        verify(transaction2).commit();
-    }
-
-    private boolean callUpdateConnectionService(
-            UpdateConnectivityServiceInput updateConnectivityServiceInput) {
-        try {
-            Future<RpcResult<UpdateConnectivityServiceOutput>> response =
-                    this.prestoConnectivityService
-                            .updateConnectivityService(updateConnectivityServiceInput);
-
-            return true;
-
-        } catch (Exception ex) {
-            return false;
-        }
-    }
-
-
-    @SuppressWarnings({"unchecked", "rawtypes"})
-    @Test
-    public void deleteEvc() throws InterruptedException, ExecutionException {
-
-        DeleteConnectivityServiceInput input = new DeleteConnectivityServiceInputBuilder()
-                .setServiceIdOrName(Constants.UUID).build();
-        assertEquals(true, callDeleteConnectionService(input));
-
-        final InstanceIdentifier<?> evcKey = InstanceIdentifier.create(MefServices.class)
-                .child(CarrierEthernet.class).child(SubscriberServices.class)
-                .child(Evc.class, new EvcKey(new EvcIdType(Constants.EVC_ID_TYPE)));
-
-        when(dataBroker.newWriteOnlyTransaction()).thenReturn(transaction);
-        doNothing().when(transaction).delete(any(LogicalDatastoreType.class),
-                any(InstanceIdentifier.class));
-        when(transaction.commit()).thenReturn(checkedFuture);
-        assertEquals(true, LegatoUtils.deleteFromOperationalDB(evcKey, dataBroker));
-        verify(transaction).delete(any(LogicalDatastoreType.class), any(InstanceIdentifier.class));
-        verify(transaction).commit();
-        verify(mockAppender).doAppend(argThat(new ArgumentMatcher() {
-            @Override
-            public boolean matches(final Object argument) {
-                return ((LoggingEvent) argument).getFormattedMessage()
-                        .contains("Received a request to delete node");
-            }
-        }));
-
-    }
-
-    private boolean callDeleteConnectionService(
-            DeleteConnectivityServiceInput deleteConnectivityServiceInput) {
-        try {
-            this.prestoConnectivityService
-                    .deleteConnectivityService(deleteConnectivityServiceInput);
-            return true;
-
-        } catch (Exception ex) {
-            return false;
-        }
-    }
-
-
-}
index a2577734a7a3281bf9f5899297db6b2b66395371..0d66e915422a72b598bd8fe0332b2aaa6170d281 100644 (file)
@@ -7,8 +7,10 @@
  */
 
 package org.opendaylight.unimgr.mef.legato.evc;
+
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
 import static org.mockito.ArgumentMatchers.any;
 import static org.mockito.ArgumentMatchers.argThat;
 import static org.mockito.Mockito.doNothing;
@@ -19,6 +21,8 @@ import static org.mockito.Mockito.when;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.Optional;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.Future;
 
 import org.junit.Before;
 import org.junit.Test;
@@ -31,7 +35,6 @@ import org.opendaylight.mdsal.binding.api.ReadTransaction;
 import org.opendaylight.mdsal.binding.api.WriteTransaction;
 import org.opendaylight.mdsal.common.api.LogicalDatastoreType;
 import org.opendaylight.mdsal.common.api.ReadFailedException;
-import org.opendaylight.unimgr.mef.legato.LegatoServiceController;
 import org.opendaylight.unimgr.mef.legato.dao.EVCDao;
 import org.opendaylight.unimgr.mef.legato.util.LegatoUtils;
 import org.opendaylight.unimgr.mef.legato.utils.Constants;
@@ -45,7 +48,6 @@ import org.opendaylight.yang.gen.v1.urn.mef.yang.mef.legato.services.rev171215.m
 import org.opendaylight.yang.gen.v1.urn.mef.yang.mef.legato.services.rev171215.mef.services.carrier.ethernet.subscriber.services.evc.EndPointsBuilder;
 import org.opendaylight.yang.gen.v1.urn.mef.yang.mef.legato.services.rev171215.mef.services.carrier.ethernet.subscriber.services.evc.cos.names.CosName;
 import org.opendaylight.yang.gen.v1.urn.mef.yang.mef.legato.services.rev171215.mef.services.carrier.ethernet.subscriber.services.evc.cos.names.CosNameBuilder;
-import org.opendaylight.yang.gen.v1.urn.mef.yang.mef.legato.services.rev171215.mef.services.carrier.ethernet.subscriber.services.evc.cos.names.CosNameKey;
 import org.opendaylight.yang.gen.v1.urn.mef.yang.mef.legato.services.rev171215.mef.services.carrier.ethernet.subscriber.services.evc.end.points.EndPoint;
 import org.opendaylight.yang.gen.v1.urn.mef.yang.mef.legato.services.rev171215.mef.services.carrier.ethernet.subscriber.services.evc.end.points.EndPointBuilder;
 import org.opendaylight.yang.gen.v1.urn.mef.yang.mef.legato.services.rev171215.mef.services.carrier.ethernet.subscriber.services.evc.end.points.end.point.CeVlansBuilder;
@@ -57,12 +59,12 @@ import org.opendaylight.yang.gen.v1.urn.mef.yang.mef.types.rev171215.MaxFrameSiz
 import org.opendaylight.yang.gen.v1.urn.mef.yang.mef.types.rev171215.MefServiceType;
 import org.opendaylight.yang.gen.v1.urn.mef.yang.mef.types.rev171215.VlanIdType;
 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev180307.CreateConnectivityServiceInput;
-import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev180307.CreateConnectivityServiceInputBuilder;
 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev180307.DeleteConnectivityServiceInput;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev180307.DeleteConnectivityServiceInputBuilder;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev180307.DeleteConnectivityServiceOutput;
 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev180307.TapiConnectivityService;
-import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev180307.UpdateConnectivityServiceInput;
-import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev180307.UpdateConnectivityServiceInputBuilder;
 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.common.RpcResult;
 import org.powermock.api.mockito.PowerMockito;
 import org.powermock.api.support.membermodification.MemberMatcher;
 import org.powermock.api.support.membermodification.MemberModifier;
@@ -72,21 +74,20 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 import com.google.common.util.concurrent.FluentFuture;
+import com.google.common.util.concurrent.ListenableFuture;
 
 import ch.qos.logback.classic.spi.LoggingEvent;
 import ch.qos.logback.core.Appender;
 
 
-/**
+/*
  * @author Arif.Hussain@Xoriant.Com
- *
  */
 
 @RunWith(PowerMockRunner.class)
-@PrepareForTest({LogicalDatastoreType.class, LegatoUtils.class, Optional.class})
+@PrepareForTest({LegatoUtils.class})
 public class EvcUnitTest {
 
-    @Mock  private LegatoServiceController legatoServiceController;
     @Mock  private TapiConnectivityService prestoConnectivityService;
     @Mock  private DataBroker dataBroker;
     @SuppressWarnings("rawtypes")
@@ -95,22 +96,17 @@ public class EvcUnitTest {
     @Mock  private Appender mockAppender;
     @Mock  private WriteTransaction transaction;
     @Mock  private ReadTransaction readTxn ;
-    private EndPointBuilder endPointBuilder1;
-    private EndPointBuilder endPointBuilder2;
+    private EndPointBuilder endPointBuilder;
+    private EVCDao evcDao;
     private Evc evc;
     private ch.qos.logback.classic.Logger root;
 
     @SuppressWarnings("unchecked")
     @Before
     public void setUp() throws Exception {
-        legatoServiceController = PowerMockito.mock(LegatoServiceController.class, Mockito.CALLS_REAL_METHODS);
-        PowerMockito.mockStatic(LegatoUtils.class, Mockito.CALLS_REAL_METHODS);
-
-        MemberModifier.field(LegatoServiceController.class, "dataBroker").set(legatoServiceController, dataBroker);
 
         CosNameBuilder builder = new CosNameBuilder();
         builder.setName(new Identifier1024(Constants.COSNAME));
-        builder.withKey(new CosNameKey(new Identifier1024(Constants.COSNAME)));
 
         final List<CosName> cosNameList = new ArrayList<CosName>();
         cosNameList.add(builder.build());
@@ -119,24 +115,23 @@ public class EvcUnitTest {
         cosNamesBuilder.setCosName(cosNameList);
 
         final List<VlanIdType> vlanIdTypes = new ArrayList<>();
-        vlanIdTypes.add(new VlanIdType(Constants.VLAN_ID_TYPE));
+        vlanIdTypes.add(new VlanIdType(Constants.VLAN_ID));
 
         CeVlansBuilder ceVlansBuilder = new CeVlansBuilder();
         ceVlansBuilder.setCeVlan(vlanIdTypes);
 
-        endPointBuilder1 = new EndPointBuilder();
-        endPointBuilder1.setCeVlans(ceVlansBuilder.build());
-        endPointBuilder1.setUniId(new Identifier45(Constants.UNI_ID1));
-
-        endPointBuilder2 = new EndPointBuilder();
-        endPointBuilder2.setCeVlans(ceVlansBuilder.build());
-        endPointBuilder2.setUniId(new Identifier45(Constants.UNI_ID2));
-
         final List<EndPoint> endPointList = new ArrayList<EndPoint>();
-        endPointList.add(endPointBuilder1.build());
-        endPointList.add(endPointBuilder2.build());
+        endPointBuilder = new EndPointBuilder();
+        endPointBuilder.setCeVlans(ceVlansBuilder.build());
+        endPointBuilder.setUniId(new Identifier45(Constants.UNI_ID1));
+        endPointList.add(endPointBuilder.build());
+
+        endPointBuilder = new EndPointBuilder();
+        endPointBuilder.setCeVlans(ceVlansBuilder.build());
+        endPointBuilder.setUniId(new Identifier45(Constants.UNI_ID2));
+        endPointList.add(endPointBuilder.build());
 
-        evc = (Evc) new EvcBuilder().withKey(new EvcKey(new EvcIdType(Constants.EVC_ID_TYPE)))
+        evc = (Evc) new EvcBuilder().setEvcId(new EvcIdType(Constants.EVC_ID_TYPE))
                 .setMaxFrameSize(new MaxFrameSizeType(Constants.MAXFRAME_SIZE_TYPE))
                 .setEvcId(new EvcIdType(Constants.EVC_ID_TYPE)).setSvcType(MefServiceType.Epl)
                 .setConnectionType(ConnectionType.PointToPoint).setCosNames(cosNamesBuilder.build())
@@ -149,122 +144,99 @@ public class EvcUnitTest {
 
     @SuppressWarnings("unchecked")
     @Test
-    public void createEvc() throws ReadFailedException {
-
-        try {
-            assertNotNull(evc);
-            final EVCDao evcDao = mock(EVCDao.class);
-            MemberModifier.suppress(MemberMatcher.method(LegatoUtils.class, Constants.PARSE_NODES));
-            when(LegatoUtils.parseNodes(evc)).thenReturn(evcDao);
-
-            CreateConnectivityServiceInputBuilder objInputBuilder =
-                    mock(CreateConnectivityServiceInputBuilder.class);
-            MemberModifier.suppress(MemberMatcher.method(LegatoUtils.class,
-                    Constants.CREATE_CONNECTIVITY_INPUT, DataBroker.class,
-                    LogicalDatastoreType.class, InstanceIdentifier.class));
-            when(LegatoUtils.buildCreateConnectivityServiceInput(evcDao))
-                            .thenReturn((CreateConnectivityServiceInput) objInputBuilder);
-
-            final InstanceIdentifier<?> evcKey = InstanceIdentifier.create(MefServices.class)
-                    .child(CarrierEthernet.class).child(SubscriberServices.class)
-                    .child(Evc.class, new EvcKey(new EvcIdType(evc.getEvcId())));
-
-            final Optional<Evc> optEvc = PowerMockito.mock(Optional.class);
-            when(optEvc.isPresent()).thenReturn(true);
-            when(optEvc.get()).thenReturn(evc);
-
-            when(dataBroker.newWriteOnlyTransaction()).thenReturn(transaction);
-            doNothing().when(transaction).put(any(LogicalDatastoreType.class),
-                    any(InstanceIdentifier.class), any(Evc.class));
-
-            MemberModifier.suppress(MemberMatcher.method(LegatoUtils.class, Constants.READ_EVC,
-                    DataBroker.class, LogicalDatastoreType.class, InstanceIdentifier.class));
-            when(LegatoUtils.readEvc(any(DataBroker.class), any(LogicalDatastoreType.class),
-                    evcKey)).thenReturn(optEvc);
-
-            final InstanceIdentifier<SubscriberServices> instanceIdentifier =
-                    InstanceIdentifier.builder(MefServices.class).child(CarrierEthernet.class)
-                            .child(SubscriberServices.class).build();
-
-            doNothing().when(transaction).put(any(LogicalDatastoreType.class),
-                    any(InstanceIdentifier.class), any(Evc.class));
-            when(dataBroker.newWriteOnlyTransaction()).thenReturn(transaction);
-            assertEquals(true,
-                    LegatoUtils.updateEvcInOperationalDB(evc, instanceIdentifier, dataBroker));
-            verify(transaction).put(any(LogicalDatastoreType.class), any(InstanceIdentifier.class),
-                    any(Evc.class));
-            verify(transaction).commit();
-
-        } catch (Exception ex) {
-        }
+    public void testCreateEvc() throws ReadFailedException {
+
+        // having
+        assertNotNull(evc);
+        evcDao = LegatoUtils.parseNodes(evc);
+
+        PowerMockito.stub(PowerMockito.method(LegatoUtils.class, "parseNodes", Evc.class)).toReturn(evcDao);
+
+        // when
+        CreateConnectivityServiceInput future = mock(CreateConnectivityServiceInput.class);
+
+        MemberModifier.suppress(MemberMatcher.method(LegatoUtils.class, Constants.CREATE_CONNECTIVITY_INPUT));
+        PowerMockito.mockStatic(LegatoUtils.class, Mockito.CALLS_REAL_METHODS);
+
+        PowerMockito.stub(PowerMockito.method(
+                LegatoUtils.class, "buildCreateConnectivityServiceInput", EVCDao.class, String.class, List.class))
+        .toReturn(future);
+
+        // then
+        final Optional<Evc> optEvc = mock(Optional.class);
+        when(optEvc.isPresent()).thenReturn(true);
+        when(optEvc.get()).thenReturn(evc);
+
+        final InstanceIdentifier<SubscriberServices> instanceIdentifier = InstanceIdentifier.builder(MefServices.class)
+            .child(CarrierEthernet.class)
+            .child(SubscriberServices.class).build();
+
+        when(dataBroker.newWriteOnlyTransaction()).thenReturn(transaction);
+
+        PowerMockito.stub(
+                PowerMockito.method(LegatoUtils.class,
+                        "readEvc", DataBroker.class, LogicalDatastoreType.class, InstanceIdentifier.class))
+        .toReturn(optEvc);
 
+        when(transaction.commit()).thenReturn(checkedFuture);
+
+        assertEquals(true, LegatoUtils.updateEvcInOperationalDB(evc, instanceIdentifier, dataBroker));
+        verify(transaction).put(any(LogicalDatastoreType.class), any(InstanceIdentifier.class), any(SubscriberServices.class));
+        verify(transaction).commit();
     }
 
     @SuppressWarnings("unchecked")
     @Test
-    public void updateEvc() {
-        try {
-            assertNotNull(evc);
-            final EVCDao evcDao = mock(EVCDao.class);
-            MemberModifier.suppress(MemberMatcher.method(LegatoUtils.class, Constants.PARSE_NODES));
-            when(LegatoUtils.parseNodes(evc)).thenReturn(evcDao);
-
-            final UpdateConnectivityServiceInputBuilder objBuilder =
-                    mock(UpdateConnectivityServiceInputBuilder.class);
-            MemberModifier.suppress(MemberMatcher.method(LegatoUtils.class,
-                    Constants.UPDATE_CONNECTIVITY_INPUT, DataBroker.class,
-                    LogicalDatastoreType.class, InstanceIdentifier.class));
-            when(LegatoUtils.buildUpdateConnectivityServiceInput(evcDao, evcDao.getUniList().get(0), Constants.UUID))
-                            .thenReturn((UpdateConnectivityServiceInput) objBuilder);
-
-            final InstanceIdentifier<?> evcKey = InstanceIdentifier.create(MefServices.class)
-                    .child(CarrierEthernet.class).child(SubscriberServices.class)
-                    .child(Evc.class, new EvcKey(new EvcIdType(Constants.EVC_ID_TYPE)));
-
-            final Optional<Evc> optEvc = mock(Optional.class);
-            when(optEvc.isPresent()).thenReturn(true);
-            when(optEvc.get()).thenReturn(evc);
-            MemberModifier.suppress(MemberMatcher.method(LegatoUtils.class, Constants.READ_EVC,
-                    DataBroker.class, LogicalDatastoreType.class, InstanceIdentifier.class));
-            when(LegatoUtils.readEvc(any(DataBroker.class), any(LogicalDatastoreType.class),
-                    evcKey)).thenReturn(optEvc);
-            when(optEvc.isPresent()).thenReturn(true);
-            doNothing().when(transaction).delete(any(LogicalDatastoreType.class),
-                    any(InstanceIdentifier.class));
-
-            MemberModifier.suppress(MemberMatcher.method(LegatoUtils.class,
-                    Constants.DELETE_NODES_FROM_OPERATIONAL, DataBroker.class,
-                    LogicalDatastoreType.class, InstanceIdentifier.class));
-            LegatoUtils.deleteFromOperationalDB(evcKey, any(DataBroker.class));
-            verify(transaction).delete(LogicalDatastoreType.OPERATIONAL, evcKey);
-            verify(transaction).commit();
-            when(optEvc.isPresent()).thenReturn(true);
-            doNothing().when(transaction).put(any(LogicalDatastoreType.class),
-                    any(InstanceIdentifier.class), any(Evc.class));
-
-            final InstanceIdentifier<SubscriberServices> instanceIdentifier =
-                    InstanceIdentifier.builder(MefServices.class).child(CarrierEthernet.class)
-                            .child(SubscriberServices.class).build();
-
-            WriteTransaction transaction2 = Mockito.mock(WriteTransaction.class);
-            when(dataBroker.newWriteOnlyTransaction()).thenReturn(transaction2);
-            doNothing().when(transaction2).put(any(LogicalDatastoreType.class),
-                    any(InstanceIdentifier.class), any(Evc.class));
-            when(transaction2.commit()).thenReturn(checkedFuture);
-            assertEquals(true,
-                    LegatoUtils.updateEvcInOperationalDB(evc, instanceIdentifier, dataBroker));
-            verify(transaction2).put(any(LogicalDatastoreType.class), any(InstanceIdentifier.class),
-                    any(Evc.class));
-            verify(transaction2).commit();
-        } catch (Exception e) {
-        }
+    public void testUpdateEvc() throws InterruptedException, ExecutionException, ReadFailedException {
+
+        // having
+        assertNotNull(evc);
+        evcDao = LegatoUtils.parseNodes(evc);
+
+        PowerMockito.stub(PowerMockito.method(LegatoUtils.class, "parseNodes", Evc.class)).toReturn(evcDao);
+
+        assertEquals(ConnectionType.PointToPoint.getName(), evcDao.getConnectionType());
+        assertEquals(MefServiceType.Epl.getName(), evcDao.getSvcType());
+        DeleteConnectivityServiceInput deleteConnectivityServiceInput = new DeleteConnectivityServiceInputBuilder()
+            .setServiceIdOrName(Constants.UUID).build();
+
+        final RpcResult<DeleteConnectivityServiceOutput> rpcResult = mock(RpcResult.class);
+        final ListenableFuture<RpcResult<DeleteConnectivityServiceOutput>> future = mock(ListenableFuture.class);
+
+        when(future.get()).thenReturn(rpcResult);
+        when(rpcResult.isSuccessful()).thenReturn(true);
+        when(prestoConnectivityService.deleteConnectivityService(deleteConnectivityServiceInput)).thenReturn(future);
+
+        // when
+        Future<RpcResult<DeleteConnectivityServiceOutput>> result = this.prestoConnectivityService
+            .deleteConnectivityService(deleteConnectivityServiceInput);
+
+        // then
+        assertTrue(result.get().isSuccessful());
+
+        this.testCreateEvc();
     }
 
     @SuppressWarnings({"unchecked", "rawtypes"})
     @Test
-    public void deleteEvc() throws Exception {
-        DeleteConnectivityServiceInput input = mock(DeleteConnectivityServiceInput.class);
-        assertEquals(true, callDeleteConnectionService(input));
+    public void testDeleteEvc() throws Exception {
+        // having
+        DeleteConnectivityServiceInput input = new DeleteConnectivityServiceInputBuilder()
+                .setServiceIdOrName(Constants.UUID).build();
+
+        final RpcResult<DeleteConnectivityServiceOutput> rpcResult = mock(RpcResult.class);
+        final ListenableFuture<RpcResult<DeleteConnectivityServiceOutput>> future = mock(ListenableFuture.class);
+
+        when(future.get()).thenReturn(rpcResult);
+        when(rpcResult.isSuccessful()).thenReturn(true);
+        when(prestoConnectivityService.deleteConnectivityService(input)).thenReturn(future);
+
+        // when
+        Future<RpcResult<DeleteConnectivityServiceOutput>> result = this.prestoConnectivityService
+            .deleteConnectivityService(input);
+
+        // then
+        assertTrue(result.get().isSuccessful());
 
         final InstanceIdentifier<?> evcKey = InstanceIdentifier.create(MefServices.class)
                 .child(CarrierEthernet.class).child(SubscriberServices.class)
@@ -274,7 +246,9 @@ public class EvcUnitTest {
         doNothing().when(transaction).delete(any(LogicalDatastoreType.class),
                 any(InstanceIdentifier.class));
         when(transaction.commit()).thenReturn(checkedFuture);
+
         assertEquals(true, LegatoUtils.deleteFromOperationalDB(evcKey, dataBroker));
+
         verify(transaction).delete(any(LogicalDatastoreType.class), any(InstanceIdentifier.class));
         verify(transaction).commit();
         verify(mockAppender).doAppend(argThat(new ArgumentMatcher() {
@@ -287,15 +261,4 @@ public class EvcUnitTest {
 
     }
 
-    private boolean callDeleteConnectionService(
-            DeleteConnectivityServiceInput deleteConnectivityServiceInput) {
-        try {
-            this.prestoConnectivityService
-                    .deleteConnectivityService(deleteConnectivityServiceInput);
-            return true;
-
-        } catch (Exception ex) {
-            return false;
-        }
-    }
 }
diff --git a/legato-api/src/test/java/org/opendaylight/unimgr/mef/legato/evc/EvpLanIntegrationTest.java b/legato-api/src/test/java/org/opendaylight/unimgr/mef/legato/evc/EvpLanIntegrationTest.java
new file mode 100644 (file)
index 0000000..2d00203
--- /dev/null
@@ -0,0 +1,324 @@
+/*
+ * Copyright (c) 2018 Xoriant Corporation and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.unimgr.mef.legato.evc;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.ArgumentMatchers.argThat;
+import static org.mockito.Mockito.doNothing;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Optional;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.Future;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.ArgumentMatcher;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.opendaylight.mdsal.binding.api.DataBroker;
+import org.opendaylight.mdsal.binding.api.ReadTransaction;
+import org.opendaylight.mdsal.binding.api.WriteTransaction;
+import org.opendaylight.mdsal.common.api.LogicalDatastoreType;
+import org.opendaylight.mdsal.common.api.ReadFailedException;
+import org.opendaylight.unimgr.mef.legato.LegatoServiceController;
+import org.opendaylight.unimgr.mef.legato.dao.EVCDao;
+import org.opendaylight.unimgr.mef.legato.util.LegatoUtils;
+import org.opendaylight.unimgr.mef.legato.utils.Constants;
+import org.opendaylight.yang.gen.v1.urn.mef.yang.mef.legato.services.rev171215.MefServices;
+import org.opendaylight.yang.gen.v1.urn.mef.yang.mef.legato.services.rev171215.mef.services.CarrierEthernet;
+import org.opendaylight.yang.gen.v1.urn.mef.yang.mef.legato.services.rev171215.mef.services.carrier.ethernet.SubscriberServices;
+import org.opendaylight.yang.gen.v1.urn.mef.yang.mef.legato.services.rev171215.mef.services.carrier.ethernet.subscriber.services.Evc;
+import org.opendaylight.yang.gen.v1.urn.mef.yang.mef.legato.services.rev171215.mef.services.carrier.ethernet.subscriber.services.EvcBuilder;
+import org.opendaylight.yang.gen.v1.urn.mef.yang.mef.legato.services.rev171215.mef.services.carrier.ethernet.subscriber.services.EvcKey;
+import org.opendaylight.yang.gen.v1.urn.mef.yang.mef.legato.services.rev171215.mef.services.carrier.ethernet.subscriber.services.evc.EndPointsBuilder;
+import org.opendaylight.yang.gen.v1.urn.mef.yang.mef.legato.services.rev171215.mef.services.carrier.ethernet.subscriber.services.evc.end.points.EndPoint;
+import org.opendaylight.yang.gen.v1.urn.mef.yang.mef.legato.services.rev171215.mef.services.carrier.ethernet.subscriber.services.evc.end.points.EndPointBuilder;
+import org.opendaylight.yang.gen.v1.urn.mef.yang.mef.legato.services.rev171215.mef.services.carrier.ethernet.subscriber.services.evc.end.points.end.point.CeVlansBuilder;
+import org.opendaylight.yang.gen.v1.urn.mef.yang.mef.types.rev171215.ConnectionType;
+import org.opendaylight.yang.gen.v1.urn.mef.yang.mef.types.rev171215.EvcIdType;
+import org.opendaylight.yang.gen.v1.urn.mef.yang.mef.types.rev171215.EvcUniRoleType;
+import org.opendaylight.yang.gen.v1.urn.mef.yang.mef.types.rev171215.Identifier45;
+import org.opendaylight.yang.gen.v1.urn.mef.yang.mef.types.rev171215.MaxFrameSizeType;
+import org.opendaylight.yang.gen.v1.urn.mef.yang.mef.types.rev171215.MefServiceType;
+import org.opendaylight.yang.gen.v1.urn.mef.yang.mef.types.rev171215.VlanIdType;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev180307.CreateConnectivityServiceInput;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev180307.CreateConnectivityServiceOutput;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev180307.DeleteConnectivityServiceInput;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev180307.DeleteConnectivityServiceInputBuilder;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev180307.DeleteConnectivityServiceOutput;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev180307.TapiConnectivityService;
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.common.RpcResult;
+import org.powermock.api.mockito.PowerMockito;
+import org.powermock.api.support.membermodification.MemberMatcher;
+import org.powermock.api.support.membermodification.MemberModifier;
+import org.powermock.core.classloader.annotations.PrepareForTest;
+import org.powermock.modules.junit4.PowerMockRunner;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.google.common.util.concurrent.FluentFuture;
+import com.google.common.util.concurrent.ListenableFuture;
+
+import ch.qos.logback.classic.spi.LoggingEvent;
+import ch.qos.logback.core.Appender;
+
+
+/*
+ * @author Om.SAwasthi@Xoriant.Com
+ */
+
+@SuppressWarnings("deprecation")
+@RunWith(PowerMockRunner.class)
+@PrepareForTest({LegatoUtils.class})
+public class EvpLanIntegrationTest {
+    @Mock
+    private LegatoServiceController legatoServiceController;
+    @Mock
+    private TapiConnectivityService prestoConnectivityService;
+    @Mock
+    private DataBroker dataBroker;
+    @SuppressWarnings("rawtypes")
+    @Mock
+    private Appender mockAppender;
+    @Mock
+    private WriteTransaction transaction;
+    @Mock
+    private ReadTransaction readTxn;
+    @SuppressWarnings("rawtypes")
+    @Mock
+    private FluentFuture fluentFuture;
+    private EndPointBuilder endPointBuilder;
+    private Evc evc;
+    private EVCDao evcDao;
+    private ch.qos.logback.classic.Logger root;
+
+    @SuppressWarnings("unchecked")
+    @Before
+    public void setUp() throws Exception {
+
+        final List<EndPoint> endPointList = new ArrayList<EndPoint>();
+
+        final List<VlanIdType> vlanList = new ArrayList<VlanIdType>();
+        vlanList.add(new VlanIdType(Constants.VLAN_ID));
+
+        endPointBuilder = new EndPointBuilder();
+        endPointBuilder.setUniId(new Identifier45(Constants.UNI_ID1));
+        endPointBuilder.setRole(EvcUniRoleType.Root);
+        endPointBuilder.setCeVlans((new CeVlansBuilder().setCeVlan(vlanList)).build());
+        endPointList.add(endPointBuilder.build());
+
+        endPointBuilder = new EndPointBuilder();
+        endPointBuilder.setUniId(new Identifier45(Constants.UNI_ID2));
+        endPointBuilder.setRole(EvcUniRoleType.Root);
+        endPointBuilder.setCeVlans((new CeVlansBuilder().setCeVlan(vlanList)).build());
+        endPointList.add(endPointBuilder.build());
+
+        endPointBuilder = new EndPointBuilder();
+        endPointBuilder.setUniId(new Identifier45(Constants.UNI_ID3));
+        endPointBuilder.setRole(EvcUniRoleType.Root);
+        endPointBuilder.setCeVlans((new CeVlansBuilder().setCeVlan(vlanList)).build());
+        endPointList.add(endPointBuilder.build());
+
+        evc = (Evc) new EvcBuilder().setEvcId(new EvcIdType(Constants.EVC_ID_TYPE))
+                .setEndPoints(new EndPointsBuilder().setEndPoint(endPointList).build())
+                .setMaxFrameSize(new MaxFrameSizeType(Constants.MAXFRAME_SIZE_TYPE))
+                .setEvcId(new EvcIdType(Constants.EVC_ID_TYPE))
+                .setConnectionType(ConnectionType.MultipointToMultipoint)
+                .setSvcType(MefServiceType.Evplan).build();
+
+        root = (ch.qos.logback.classic.Logger) LoggerFactory.getLogger(Logger.ROOT_LOGGER_NAME);
+        when(mockAppender.getName()).thenReturn("MOCK");
+        root.addAppender(mockAppender);
+
+    }
+
+    @SuppressWarnings({"unchecked"})
+    @Test
+    public void testCreateService() throws ReadFailedException, InterruptedException, ExecutionException {
+
+        //having
+        assertNotNull(evc);
+        evcDao = LegatoUtils.parseNodes(evc);
+
+        PowerMockito.stub(PowerMockito.method(LegatoUtils.class, "parseNodes", Evc.class)).toReturn(evcDao);
+
+        assertEquals(ConnectionType.MultipointToMultipoint.getName(), evcDao.getConnectionType());
+        assertEquals(MefServiceType.Evplan.getName(), evcDao.getSvcType());
+
+        CreateConnectivityServiceInput input = LegatoUtils.buildCreateConnectivityServiceInput(evcDao,
+            String.valueOf(Constants.VLAN_ID), evc.getEndPoints().getEndPoint());
+
+        final RpcResult<CreateConnectivityServiceOutput> rpcResult = mock(RpcResult.class);
+        final ListenableFuture<RpcResult<CreateConnectivityServiceOutput>> future = mock(ListenableFuture.class);
+
+        when(future.get()).thenReturn(rpcResult);
+        when(rpcResult.isSuccessful()).thenReturn(true);
+        when(prestoConnectivityService.createConnectivityService(input)).thenReturn(future);
+
+        //when
+        Future<RpcResult<CreateConnectivityServiceOutput>> result = this.prestoConnectivityService
+            .createConnectivityService(input);
+        //then
+        assertTrue(result.get().isSuccessful());
+
+        final Optional<Evc> optEvc = mock(Optional.class);
+        when(optEvc.isPresent()).thenReturn(true);
+        when(optEvc.get()).thenReturn(evc);
+
+        final InstanceIdentifier<SubscriberServices> instanceIdentifier = InstanceIdentifier.builder(MefServices.class)
+            .child(CarrierEthernet.class).child(SubscriberServices.class).build();
+
+        when(dataBroker.newWriteOnlyTransaction()).thenReturn(transaction);
+
+        PowerMockito.stub(
+                PowerMockito.method(LegatoUtils.class,
+                        "readEvc", DataBroker.class, LogicalDatastoreType.class, InstanceIdentifier.class))
+        .toReturn(optEvc);
+
+        when(transaction.commit()).thenReturn(fluentFuture);
+
+        assertEquals(true,LegatoUtils.updateEvcInOperationalDB(evc, instanceIdentifier, dataBroker));
+        verify(transaction).put(any(LogicalDatastoreType.class), any(InstanceIdentifier.class), any(SubscriberServices.class));
+        verify(transaction).commit();
+
+    }
+
+    @Test
+    public void testcreateServiceBadInput() throws ReadFailedException, ExecutionException {
+        // having
+        assertNotNull(evc);
+        evcDao = LegatoUtils.parseNodes(evc);
+        evcDao.setSvcType(MefServiceType.Eplan.getName());
+
+        PowerMockito.stub(PowerMockito.method(LegatoUtils.class, "parseNodes", Evc.class)).toReturn(evcDao);
+
+        // then
+        assertEquals(ConnectionType.MultipointToMultipoint.getName(), evcDao.getConnectionType());
+        assertNotEquals(MefServiceType.Evplan.getName(), evcDao.getSvcType());
+
+    }
+
+    @SuppressWarnings("unchecked")
+    @Test
+    public void testUpdateService() throws InterruptedException, ExecutionException, ReadFailedException {
+
+        // having
+        assertNotNull(evc);
+        evcDao = LegatoUtils.parseNodes(evc);
+
+        PowerMockito.stub(PowerMockito.method(LegatoUtils.class, "parseNodes", Evc.class)).toReturn(evcDao);
+
+        assertEquals(ConnectionType.MultipointToMultipoint.getName(), evcDao.getConnectionType());
+        assertEquals(MefServiceType.Evplan.getName(), evcDao.getSvcType());
+        DeleteConnectivityServiceInput deleteConnectivityServiceInput = new DeleteConnectivityServiceInputBuilder()
+            .setServiceIdOrName(Constants.UUID).build();
+
+        final RpcResult<DeleteConnectivityServiceOutput> rpcResult = mock(RpcResult.class);
+        final ListenableFuture<RpcResult<DeleteConnectivityServiceOutput>> future = mock(ListenableFuture.class);
+
+        when(future.get()).thenReturn(rpcResult);
+        when(rpcResult.isSuccessful()).thenReturn(true);
+        when(prestoConnectivityService.deleteConnectivityService(deleteConnectivityServiceInput)).thenReturn(future);
+
+        // when
+        Future<RpcResult<DeleteConnectivityServiceOutput>> delResult = this.prestoConnectivityService
+            .deleteConnectivityService(deleteConnectivityServiceInput);
+
+        // then
+        assertTrue(delResult.get().isSuccessful());
+
+        this.testCreateService();
+    }
+
+    @Test
+    public void testUpdateServiceBadInput() throws InterruptedException, ExecutionException {
+
+        // having
+        assertNotNull(evc);
+        evcDao = LegatoUtils.parseNodes(evc);
+        evcDao.setSvcType(MefServiceType.Eplan.getName());
+
+        PowerMockito.stub(PowerMockito.method(LegatoUtils.class, "parseNodes", Evc.class)).toReturn(evcDao);
+
+        // then
+        assertEquals(ConnectionType.MultipointToMultipoint.getName(), evcDao.getConnectionType());
+        assertNotEquals(MefServiceType.Evplan.getName(), evcDao.getSvcType());
+    }
+
+    @SuppressWarnings({"unchecked", "rawtypes"})
+    @Test
+    public void testDeleteService() throws InterruptedException, ExecutionException {
+
+        // having
+        DeleteConnectivityServiceInput input = new DeleteConnectivityServiceInputBuilder()
+                .setServiceIdOrName(Constants.UUID).build();
+
+        final RpcResult<DeleteConnectivityServiceOutput> rpcResult = mock(RpcResult.class);
+        final ListenableFuture<RpcResult<DeleteConnectivityServiceOutput>> future = mock(ListenableFuture.class);
+
+        when(future.get()).thenReturn(rpcResult);
+        when(rpcResult.isSuccessful()).thenReturn(true);
+        when(prestoConnectivityService.deleteConnectivityService(input)).thenReturn(future);
+
+        // when
+        Future<RpcResult<DeleteConnectivityServiceOutput>> result = this.prestoConnectivityService
+            .deleteConnectivityService(input);
+
+        // then
+        assertTrue(result.get().isSuccessful());
+
+        final InstanceIdentifier<?> evcKey = InstanceIdentifier.create(MefServices.class)
+                .child(CarrierEthernet.class).child(SubscriberServices.class)
+                .child(Evc.class, new EvcKey(new EvcIdType(Constants.EVC_ID_TYPE)));
+
+        when(dataBroker.newWriteOnlyTransaction()).thenReturn(transaction);
+        doNothing().when(transaction).delete(any(LogicalDatastoreType.class), any(InstanceIdentifier.class));
+        when(transaction.commit()).thenReturn(fluentFuture);
+
+        assertEquals(true, LegatoUtils.deleteFromOperationalDB(evcKey, dataBroker));
+
+        verify(transaction).delete(any(LogicalDatastoreType.class), any(InstanceIdentifier.class));
+        verify(transaction).commit();
+        verify(mockAppender).doAppend(argThat(new ArgumentMatcher() {
+            @Override
+            public boolean matches(final Object argument) {
+                return ((LoggingEvent) argument).getFormattedMessage()
+                        .contains("Received a request to delete node");
+            }
+        }));
+
+    }
+
+    @Test
+    public void testDeleteServiceBadInput() throws InterruptedException, ExecutionException {
+
+        // having
+        String uuid = "cs:162052f6bb1:73aaf0f6";
+
+        // when
+        DeleteConnectivityServiceInput input = new DeleteConnectivityServiceInputBuilder()
+            .setServiceIdOrName(Constants.UUID).build();
+
+        // then
+        assertNotEquals(uuid, input.getServiceIdOrName());
+
+    }
+
+}
diff --git a/legato-api/src/test/java/org/opendaylight/unimgr/mef/legato/evc/EvpLineIntegrationTest.java b/legato-api/src/test/java/org/opendaylight/unimgr/mef/legato/evc/EvpLineIntegrationTest.java
new file mode 100644 (file)
index 0000000..1374155
--- /dev/null
@@ -0,0 +1,316 @@
+/*
+ * Copyright (c) 2018 Xoriant Corporation and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.unimgr.mef.legato.evc;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.ArgumentMatchers.argThat;
+import static org.mockito.Mockito.doNothing;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Optional;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.Future;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.ArgumentMatcher;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.opendaylight.mdsal.binding.api.DataBroker;
+import org.opendaylight.mdsal.binding.api.ReadTransaction;
+import org.opendaylight.mdsal.binding.api.WriteTransaction;
+import org.opendaylight.mdsal.common.api.LogicalDatastoreType;
+import org.opendaylight.mdsal.common.api.ReadFailedException;
+import org.opendaylight.unimgr.mef.legato.LegatoServiceController;
+import org.opendaylight.unimgr.mef.legato.dao.EVCDao;
+import org.opendaylight.unimgr.mef.legato.util.LegatoUtils;
+import org.opendaylight.unimgr.mef.legato.utils.Constants;
+import org.opendaylight.yang.gen.v1.urn.mef.yang.mef.legato.services.rev171215.MefServices;
+import org.opendaylight.yang.gen.v1.urn.mef.yang.mef.legato.services.rev171215.mef.services.CarrierEthernet;
+import org.opendaylight.yang.gen.v1.urn.mef.yang.mef.legato.services.rev171215.mef.services.carrier.ethernet.SubscriberServices;
+import org.opendaylight.yang.gen.v1.urn.mef.yang.mef.legato.services.rev171215.mef.services.carrier.ethernet.subscriber.services.Evc;
+import org.opendaylight.yang.gen.v1.urn.mef.yang.mef.legato.services.rev171215.mef.services.carrier.ethernet.subscriber.services.EvcBuilder;
+import org.opendaylight.yang.gen.v1.urn.mef.yang.mef.legato.services.rev171215.mef.services.carrier.ethernet.subscriber.services.EvcKey;
+import org.opendaylight.yang.gen.v1.urn.mef.yang.mef.legato.services.rev171215.mef.services.carrier.ethernet.subscriber.services.evc.EndPointsBuilder;
+import org.opendaylight.yang.gen.v1.urn.mef.yang.mef.legato.services.rev171215.mef.services.carrier.ethernet.subscriber.services.evc.end.points.EndPoint;
+import org.opendaylight.yang.gen.v1.urn.mef.yang.mef.legato.services.rev171215.mef.services.carrier.ethernet.subscriber.services.evc.end.points.EndPointBuilder;
+import org.opendaylight.yang.gen.v1.urn.mef.yang.mef.legato.services.rev171215.mef.services.carrier.ethernet.subscriber.services.evc.end.points.end.point.CeVlansBuilder;
+import org.opendaylight.yang.gen.v1.urn.mef.yang.mef.types.rev171215.ConnectionType;
+import org.opendaylight.yang.gen.v1.urn.mef.yang.mef.types.rev171215.EvcIdType;
+import org.opendaylight.yang.gen.v1.urn.mef.yang.mef.types.rev171215.EvcUniRoleType;
+import org.opendaylight.yang.gen.v1.urn.mef.yang.mef.types.rev171215.Identifier45;
+import org.opendaylight.yang.gen.v1.urn.mef.yang.mef.types.rev171215.MaxFrameSizeType;
+import org.opendaylight.yang.gen.v1.urn.mef.yang.mef.types.rev171215.MefServiceType;
+import org.opendaylight.yang.gen.v1.urn.mef.yang.mef.types.rev171215.VlanIdType;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev180307.CreateConnectivityServiceInput;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev180307.CreateConnectivityServiceOutput;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev180307.DeleteConnectivityServiceInput;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev180307.DeleteConnectivityServiceInputBuilder;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev180307.DeleteConnectivityServiceOutput;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev180307.TapiConnectivityService;
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.common.RpcResult;
+import org.powermock.api.mockito.PowerMockito;
+import org.powermock.api.support.membermodification.MemberMatcher;
+import org.powermock.api.support.membermodification.MemberModifier;
+import org.powermock.core.classloader.annotations.PrepareForTest;
+import org.powermock.modules.junit4.PowerMockRunner;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.google.common.util.concurrent.FluentFuture;
+import com.google.common.util.concurrent.ListenableFuture;
+
+import ch.qos.logback.classic.spi.LoggingEvent;
+import ch.qos.logback.core.Appender;
+
+
+/*
+ * @author Om.SAwasthi@Xoriant.Com
+ */
+
+@SuppressWarnings("deprecation")
+@RunWith(PowerMockRunner.class)
+@PrepareForTest({LegatoUtils.class})
+public class EvpLineIntegrationTest {
+
+    @Mock
+    private LegatoServiceController legatoServiceController;
+    @Mock
+    private TapiConnectivityService prestoConnectivityService;
+    @Mock
+    private DataBroker dataBroker;
+    @SuppressWarnings("rawtypes")
+    @Mock
+    private Appender mockAppender;
+    @Mock
+    private WriteTransaction transaction;
+    @Mock
+    private ReadTransaction readTxn;
+    @SuppressWarnings("rawtypes")
+    @Mock
+    private FluentFuture fluentFuture;
+    private EndPointBuilder endPointBuilder;
+    private Evc evc;
+    private EVCDao evcDao;
+    private ch.qos.logback.classic.Logger root;
+
+    @SuppressWarnings("unchecked")
+    @Before
+    public void setUp() throws Exception {
+
+        final List<EndPoint> endPointList = new ArrayList<EndPoint>();
+
+        final List<VlanIdType> vlanList = new ArrayList<VlanIdType>();
+        vlanList.add(new VlanIdType(new Integer(Constants.VLAN_ID)));
+
+        endPointBuilder = new EndPointBuilder();
+        endPointBuilder.setUniId(new Identifier45(Constants.UNI_ID1));
+        endPointBuilder.setRole(EvcUniRoleType.Root);
+        endPointBuilder.setCeVlans((new CeVlansBuilder().setCeVlan(vlanList)).build());
+        endPointList.add(endPointBuilder.build());
+
+        endPointBuilder = new EndPointBuilder();
+        endPointBuilder.setUniId(new Identifier45(Constants.UNI_ID2));
+        endPointBuilder.setRole(EvcUniRoleType.Root);
+        endPointBuilder.setCeVlans((new CeVlansBuilder().setCeVlan(vlanList)).build());
+        endPointList.add(endPointBuilder.build());
+
+        evc = (Evc) new EvcBuilder().setEvcId(new EvcIdType(Constants.EVC_ID_TYPE))
+                .setEndPoints(new EndPointsBuilder().setEndPoint(endPointList).build())
+                .setMaxFrameSize(new MaxFrameSizeType(Constants.MAXFRAME_SIZE_TYPE))
+                .setEvcId(new EvcIdType(Constants.EVC_ID_TYPE))
+                .setConnectionType(ConnectionType.PointToPoint).setSvcType(MefServiceType.Evpl)
+                .build();
+
+        root = (ch.qos.logback.classic.Logger) LoggerFactory.getLogger(Logger.ROOT_LOGGER_NAME);
+        when(mockAppender.getName()).thenReturn("MOCK");
+        root.addAppender(mockAppender);
+    }
+
+    @SuppressWarnings({"unchecked"})
+    @Test
+    public void testCreateService() throws ReadFailedException, InterruptedException, ExecutionException {
+
+        //having
+        assertNotNull(evc);
+        evcDao = LegatoUtils.parseNodes(evc);
+
+        PowerMockito.stub(PowerMockito.method(LegatoUtils.class, "parseNodes", Evc.class)).toReturn(evcDao);
+
+        assertEquals(ConnectionType.PointToPoint.getName(), evcDao.getConnectionType());
+        assertEquals(MefServiceType.Evpl.getName(), evcDao.getSvcType());
+
+        CreateConnectivityServiceInput input = LegatoUtils.buildCreateConnectivityServiceInput(evcDao,
+            String.valueOf(Constants.VLAN_ID), evc.getEndPoints().getEndPoint());
+
+        final RpcResult<CreateConnectivityServiceOutput> rpcResult = mock(RpcResult.class);
+        final ListenableFuture<RpcResult<CreateConnectivityServiceOutput>> future = mock(ListenableFuture.class);
+
+        when(future.get()).thenReturn(rpcResult);
+        when(rpcResult.isSuccessful()).thenReturn(true);
+        when(prestoConnectivityService.createConnectivityService(input)).thenReturn(future);
+
+        //when
+        Future<RpcResult<CreateConnectivityServiceOutput>> result = this.prestoConnectivityService
+            .createConnectivityService(input);
+        //then
+        assertTrue(result.get().isSuccessful());
+
+        final Optional<Evc> optEvc = mock(Optional.class);
+        when(optEvc.isPresent()).thenReturn(true);
+        when(optEvc.get()).thenReturn(evc);
+
+        final InstanceIdentifier<SubscriberServices> instanceIdentifier = InstanceIdentifier.builder(MefServices.class)
+            .child(CarrierEthernet.class).child(SubscriberServices.class).build();
+
+        when(dataBroker.newWriteOnlyTransaction()).thenReturn(transaction);
+
+        PowerMockito.stub(
+                PowerMockito.method(LegatoUtils.class,
+                        "readEvc", DataBroker.class, LogicalDatastoreType.class, InstanceIdentifier.class))
+        .toReturn(optEvc);
+
+        when(transaction.commit()).thenReturn(fluentFuture);
+
+        assertEquals(true,LegatoUtils.updateEvcInOperationalDB(evc, instanceIdentifier, dataBroker));
+        verify(transaction).put(any(LogicalDatastoreType.class), any(InstanceIdentifier.class), any(SubscriberServices.class));
+        verify(transaction).commit();
+    }
+
+    @Test
+    public void testcreateServiceBadInput() throws ReadFailedException, ExecutionException {
+        // having
+        assertNotNull(evc);
+        evcDao = LegatoUtils.parseNodes(evc);
+        evcDao.setSvcType(MefServiceType.Epl.getName());
+
+        PowerMockito.stub(PowerMockito.method(LegatoUtils.class, "parseNodes", Evc.class)).toReturn(evcDao);
+
+        // then
+        assertEquals(ConnectionType.PointToPoint.getName(), evcDao.getConnectionType());
+        assertNotEquals(MefServiceType.Evpl.getName(), evcDao.getSvcType());
+
+    }
+
+    @SuppressWarnings("unchecked")
+    @Test
+    public void testUpdateService() throws InterruptedException, ExecutionException, ReadFailedException {
+
+        // having
+        assertNotNull(evc);
+        evcDao = LegatoUtils.parseNodes(evc);
+
+        PowerMockito.stub(PowerMockito.method(LegatoUtils.class, "parseNodes", Evc.class)).toReturn(evcDao);
+
+        assertEquals(ConnectionType.PointToPoint.getName(), evcDao.getConnectionType());
+        assertEquals(MefServiceType.Evpl.getName(), evcDao.getSvcType());
+        DeleteConnectivityServiceInput deleteConnectivityServiceInput = new DeleteConnectivityServiceInputBuilder()
+            .setServiceIdOrName(Constants.UUID).build();
+
+        final RpcResult<DeleteConnectivityServiceOutput> rpcResult = mock(RpcResult.class);
+        final ListenableFuture<RpcResult<DeleteConnectivityServiceOutput>> future = mock(ListenableFuture.class);
+
+        when(future.get()).thenReturn(rpcResult);
+        when(rpcResult.isSuccessful()).thenReturn(true);
+        when(prestoConnectivityService.deleteConnectivityService(deleteConnectivityServiceInput)).thenReturn(future);
+
+        // when
+        Future<RpcResult<DeleteConnectivityServiceOutput>> delResult = this.prestoConnectivityService
+            .deleteConnectivityService(deleteConnectivityServiceInput);
+
+        // then
+        assertTrue(delResult.get().isSuccessful());
+
+        this.testCreateService();
+    }
+
+    @Test
+    public void testUpdateServiceBadInput() throws InterruptedException, ExecutionException {
+
+        // having
+        assertNotNull(evc);
+        evcDao = LegatoUtils.parseNodes(evc);
+        evcDao.setSvcType(MefServiceType.Evplan.getName());
+
+        PowerMockito.stub(PowerMockito.method(LegatoUtils.class, "parseNodes", Evc.class)).toReturn(evcDao);
+
+        // then
+        assertEquals(ConnectionType.PointToPoint.getName(), evcDao.getConnectionType());
+        assertNotEquals(MefServiceType.Evpl.getName(), evcDao.getSvcType());
+    }
+
+    @SuppressWarnings({"unchecked", "rawtypes"})
+    @Test
+    public void testDeleteService() throws InterruptedException, ExecutionException {
+
+        // having
+        DeleteConnectivityServiceInput input = new DeleteConnectivityServiceInputBuilder()
+                .setServiceIdOrName(Constants.UUID).build();
+
+        final RpcResult<DeleteConnectivityServiceOutput> rpcResult = mock(RpcResult.class);
+        final ListenableFuture<RpcResult<DeleteConnectivityServiceOutput>> future = mock(ListenableFuture.class);
+
+        when(future.get()).thenReturn(rpcResult);
+        when(rpcResult.isSuccessful()).thenReturn(true);
+        when(prestoConnectivityService.deleteConnectivityService(input)).thenReturn(future);
+
+        // when
+        Future<RpcResult<DeleteConnectivityServiceOutput>> result = this.prestoConnectivityService
+            .deleteConnectivityService(input);
+
+        // then
+        assertTrue(result.get().isSuccessful());
+
+        final InstanceIdentifier<?> evcKey = InstanceIdentifier.create(MefServices.class)
+                .child(CarrierEthernet.class).child(SubscriberServices.class)
+                .child(Evc.class, new EvcKey(new EvcIdType(Constants.EVC_ID_TYPE)));
+
+        when(dataBroker.newWriteOnlyTransaction()).thenReturn(transaction);
+        doNothing().when(transaction).delete(any(LogicalDatastoreType.class), any(InstanceIdentifier.class));
+        when(transaction.commit()).thenReturn(fluentFuture);
+
+        assertEquals(true, LegatoUtils.deleteFromOperationalDB(evcKey, dataBroker));
+
+        verify(transaction).delete(any(LogicalDatastoreType.class), any(InstanceIdentifier.class));
+        verify(transaction).commit();
+        verify(mockAppender).doAppend(argThat(new ArgumentMatcher() {
+            @Override
+            public boolean matches(final Object argument) {
+                return ((LoggingEvent) argument).getFormattedMessage()
+                        .contains("Received a request to delete node");
+            }
+        }));
+
+    }
+
+    @Test
+    public void testDeleteServiceBadInput() throws InterruptedException, ExecutionException {
+
+        // having
+        String uuid = "cs:162052f6bb1:73aaf0f6";
+
+        // when
+        DeleteConnectivityServiceInput input = new DeleteConnectivityServiceInputBuilder()
+            .setServiceIdOrName(Constants.UUID).build();
+
+        // then
+        assertNotEquals(uuid, input.getServiceIdOrName());
+
+    }
+
+}
diff --git a/legato-api/src/test/java/org/opendaylight/unimgr/mef/legato/evc/EvpTreeIntegrationTest.java b/legato-api/src/test/java/org/opendaylight/unimgr/mef/legato/evc/EvpTreeIntegrationTest.java
new file mode 100644 (file)
index 0000000..e3f9e81
--- /dev/null
@@ -0,0 +1,324 @@
+/*
+ * Copyright (c) 2018 Xoriant Corporation and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.unimgr.mef.legato.evc;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.ArgumentMatchers.argThat;
+import static org.mockito.Mockito.doNothing;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Optional;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.Future;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.ArgumentMatcher;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.opendaylight.mdsal.binding.api.DataBroker;
+import org.opendaylight.mdsal.binding.api.ReadTransaction;
+import org.opendaylight.mdsal.binding.api.WriteTransaction;
+import org.opendaylight.mdsal.common.api.LogicalDatastoreType;
+import org.opendaylight.mdsal.common.api.ReadFailedException;
+import org.opendaylight.unimgr.mef.legato.LegatoServiceController;
+import org.opendaylight.unimgr.mef.legato.dao.EVCDao;
+import org.opendaylight.unimgr.mef.legato.util.LegatoUtils;
+import org.opendaylight.unimgr.mef.legato.utils.Constants;
+import org.opendaylight.yang.gen.v1.urn.mef.yang.mef.legato.services.rev171215.MefServices;
+import org.opendaylight.yang.gen.v1.urn.mef.yang.mef.legato.services.rev171215.mef.services.CarrierEthernet;
+import org.opendaylight.yang.gen.v1.urn.mef.yang.mef.legato.services.rev171215.mef.services.carrier.ethernet.SubscriberServices;
+import org.opendaylight.yang.gen.v1.urn.mef.yang.mef.legato.services.rev171215.mef.services.carrier.ethernet.subscriber.services.Evc;
+import org.opendaylight.yang.gen.v1.urn.mef.yang.mef.legato.services.rev171215.mef.services.carrier.ethernet.subscriber.services.EvcBuilder;
+import org.opendaylight.yang.gen.v1.urn.mef.yang.mef.legato.services.rev171215.mef.services.carrier.ethernet.subscriber.services.EvcKey;
+import org.opendaylight.yang.gen.v1.urn.mef.yang.mef.legato.services.rev171215.mef.services.carrier.ethernet.subscriber.services.evc.EndPointsBuilder;
+import org.opendaylight.yang.gen.v1.urn.mef.yang.mef.legato.services.rev171215.mef.services.carrier.ethernet.subscriber.services.evc.end.points.EndPoint;
+import org.opendaylight.yang.gen.v1.urn.mef.yang.mef.legato.services.rev171215.mef.services.carrier.ethernet.subscriber.services.evc.end.points.EndPointBuilder;
+import org.opendaylight.yang.gen.v1.urn.mef.yang.mef.legato.services.rev171215.mef.services.carrier.ethernet.subscriber.services.evc.end.points.end.point.CeVlansBuilder;
+import org.opendaylight.yang.gen.v1.urn.mef.yang.mef.types.rev171215.ConnectionType;
+import org.opendaylight.yang.gen.v1.urn.mef.yang.mef.types.rev171215.EvcIdType;
+import org.opendaylight.yang.gen.v1.urn.mef.yang.mef.types.rev171215.EvcUniRoleType;
+import org.opendaylight.yang.gen.v1.urn.mef.yang.mef.types.rev171215.Identifier45;
+import org.opendaylight.yang.gen.v1.urn.mef.yang.mef.types.rev171215.MaxFrameSizeType;
+import org.opendaylight.yang.gen.v1.urn.mef.yang.mef.types.rev171215.MefServiceType;
+import org.opendaylight.yang.gen.v1.urn.mef.yang.mef.types.rev171215.VlanIdType;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev180307.CreateConnectivityServiceInput;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev180307.CreateConnectivityServiceOutput;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev180307.DeleteConnectivityServiceInput;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev180307.DeleteConnectivityServiceInputBuilder;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev180307.DeleteConnectivityServiceOutput;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev180307.TapiConnectivityService;
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.common.RpcResult;
+import org.powermock.api.mockito.PowerMockito;
+import org.powermock.api.support.membermodification.MemberMatcher;
+import org.powermock.api.support.membermodification.MemberModifier;
+import org.powermock.core.classloader.annotations.PrepareForTest;
+import org.powermock.modules.junit4.PowerMockRunner;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.google.common.util.concurrent.FluentFuture;
+import com.google.common.util.concurrent.ListenableFuture;
+
+import ch.qos.logback.classic.spi.LoggingEvent;
+import ch.qos.logback.core.Appender;
+
+/*
+ * @author OmS.awasthi@Xoriant.Com
+ */
+
+@SuppressWarnings("deprecation")
+@RunWith(PowerMockRunner.class)
+@PrepareForTest({InstanceIdentifier.class, LogicalDatastoreType.class, LegatoUtils.class})
+public class EvpTreeIntegrationTest {
+
+    @Mock
+    private LegatoServiceController legatoServiceController;
+    @Mock
+    private TapiConnectivityService prestoConnectivityService;
+    @Mock
+    private DataBroker dataBroker;
+    @SuppressWarnings("rawtypes")
+    @Mock
+    private Appender mockAppender;
+    @Mock
+    private WriteTransaction transaction;
+    @Mock
+    private ReadTransaction readTxn;
+    @SuppressWarnings("rawtypes")
+    @Mock
+    private FluentFuture fluentFuture;
+    private EndPointBuilder endPointBuilder;
+    private Evc evc;
+    private EVCDao evcDao;
+    private ch.qos.logback.classic.Logger root;
+
+    @SuppressWarnings("unchecked")
+    @Before
+    public void setUp() throws Exception {
+
+        final List<VlanIdType> vlanList = new ArrayList<VlanIdType>();
+        vlanList.add(new VlanIdType(Constants.VLAN_ID));
+
+        final List<EndPoint> endPointList = new ArrayList<EndPoint>();
+
+        endPointBuilder = new EndPointBuilder();
+        endPointBuilder.setUniId(new Identifier45(Constants.UNI_ID1));
+        endPointBuilder.setRole(EvcUniRoleType.Root);
+        endPointBuilder.setCeVlans((new CeVlansBuilder().setCeVlan(vlanList)).build());
+        endPointList.add(endPointBuilder.build());
+
+        endPointBuilder = new EndPointBuilder();
+        endPointBuilder.setUniId(new Identifier45(Constants.UNI_ID2));
+        endPointBuilder.setRole(EvcUniRoleType.Leaf);
+        endPointBuilder.setCeVlans((new CeVlansBuilder().setCeVlan(vlanList)).build());
+        endPointList.add(endPointBuilder.build());
+
+        endPointBuilder = new EndPointBuilder();
+        endPointBuilder.setUniId(new Identifier45(Constants.UNI_ID3));
+        endPointBuilder.setRole(EvcUniRoleType.Leaf);
+        endPointBuilder.setCeVlans((new CeVlansBuilder().setCeVlan(vlanList)).build());
+        endPointList.add(endPointBuilder.build());
+
+        evc = (Evc) new EvcBuilder().setEvcId(new EvcIdType(Constants.EVC_ID_TYPE))
+                .setEndPoints(new EndPointsBuilder().setEndPoint(endPointList).build())
+                .setMaxFrameSize(new MaxFrameSizeType(Constants.MAXFRAME_SIZE_TYPE))
+                .setEvcId(new EvcIdType(Constants.EVC_ID_TYPE))
+                .setConnectionType(ConnectionType.RootedMultipoint)
+                .setSvcType(MefServiceType.Evptree).build();
+
+        root = (ch.qos.logback.classic.Logger) LoggerFactory.getLogger(Logger.ROOT_LOGGER_NAME);
+        when(mockAppender.getName()).thenReturn("MOCK");
+        root.addAppender(mockAppender);
+    }
+
+    @SuppressWarnings({"unchecked"})
+    @Test
+    public void testCreateService() throws ReadFailedException, InterruptedException, ExecutionException {
+
+        // having
+        assertNotNull(evc);
+        evcDao = LegatoUtils.parseNodes(evc);
+
+        PowerMockito.stub(PowerMockito.method(LegatoUtils.class, "parseNodes", Evc.class)).toReturn(evcDao);
+
+        assertEquals(ConnectionType.RootedMultipoint.getName(), evcDao.getConnectionType());
+        assertEquals(MefServiceType.Evptree.getName(), evcDao.getSvcType());
+
+        CreateConnectivityServiceInput input = LegatoUtils.buildCreateConnectivityServiceInput(evcDao,
+            String.valueOf(Constants.VLAN_ID), evc.getEndPoints().getEndPoint());
+
+        final RpcResult<CreateConnectivityServiceOutput> rpcResult = mock(RpcResult.class);
+        final ListenableFuture<RpcResult<CreateConnectivityServiceOutput>> future = mock(ListenableFuture.class);
+
+        when(future.get()).thenReturn(rpcResult);
+        when(rpcResult.isSuccessful()).thenReturn(true);
+        when(prestoConnectivityService.createConnectivityService(input)).thenReturn(future);
+
+        //when
+        Future<RpcResult<CreateConnectivityServiceOutput>> result = this.prestoConnectivityService
+            .createConnectivityService(input);
+        //then
+        assertTrue(result.get().isSuccessful());
+
+        final Optional<Evc> optEvc = mock(Optional.class);
+        when(optEvc.isPresent()).thenReturn(true);
+        when(optEvc.get()).thenReturn(evc);
+
+        final InstanceIdentifier<SubscriberServices> instanceIdentifier = InstanceIdentifier.builder(MefServices.class)
+            .child(CarrierEthernet.class).child(SubscriberServices.class).build();
+
+        when(dataBroker.newWriteOnlyTransaction()).thenReturn(transaction);
+
+        PowerMockito.stub(
+                PowerMockito.method(LegatoUtils.class,
+                        "readEvc", DataBroker.class, LogicalDatastoreType.class, InstanceIdentifier.class))
+        .toReturn(optEvc);
+
+        when(transaction.commit()).thenReturn(fluentFuture);
+
+        assertEquals(true,LegatoUtils.updateEvcInOperationalDB(evc, instanceIdentifier, dataBroker));
+        verify(transaction).put(any(LogicalDatastoreType.class), any(InstanceIdentifier.class), any(SubscriberServices.class));
+        verify(transaction).commit();
+    }
+
+    @Test
+    public void testcreateServiceBadInput() throws ReadFailedException, ExecutionException {
+        // having
+        assertNotNull(evc);
+        evcDao = LegatoUtils.parseNodes(evc);
+        evcDao.setSvcType(MefServiceType.Eptree.getName());
+
+        PowerMockito.stub(PowerMockito.method(LegatoUtils.class, "parseNodes", Evc.class)).toReturn(evcDao);
+
+        // then
+        assertEquals(ConnectionType.RootedMultipoint.getName(), evcDao.getConnectionType());
+        assertNotEquals(MefServiceType.Evptree.getName(), evcDao.getSvcType());
+
+    }
+
+    @SuppressWarnings("unchecked")
+    @Test
+    public void testUpdateService() throws InterruptedException, ExecutionException, ReadFailedException {
+
+        // having
+        assertNotNull(evc);
+        evcDao = LegatoUtils.parseNodes(evc);
+
+        PowerMockito.stub(PowerMockito.method(LegatoUtils.class, "parseNodes", Evc.class)).toReturn(evcDao);
+
+        assertEquals(ConnectionType.RootedMultipoint.getName(), evcDao.getConnectionType());
+        assertEquals(MefServiceType.Evptree.getName(), evcDao.getSvcType());
+        DeleteConnectivityServiceInput deleteConnectivityServiceInput = new DeleteConnectivityServiceInputBuilder()
+            .setServiceIdOrName(Constants.UUID).build();
+
+        final RpcResult<DeleteConnectivityServiceOutput> rpcResult = mock(RpcResult.class);
+        final ListenableFuture<RpcResult<DeleteConnectivityServiceOutput>> future = mock(ListenableFuture.class);
+
+        when(future.get()).thenReturn(rpcResult);
+        when(rpcResult.isSuccessful()).thenReturn(true);
+        when(prestoConnectivityService.deleteConnectivityService(deleteConnectivityServiceInput)).thenReturn(future);
+
+        // when
+        Future<RpcResult<DeleteConnectivityServiceOutput>> delResult = this.prestoConnectivityService
+            .deleteConnectivityService(deleteConnectivityServiceInput);
+
+        // then
+        assertTrue(delResult.get().isSuccessful());
+
+        this.testCreateService();
+    }
+
+    @Test
+    public void testUpdateServiceBadInput() throws InterruptedException, ExecutionException {
+
+        // having
+        assertNotNull(evc);
+        evcDao = LegatoUtils.parseNodes(evc);
+        evcDao.setSvcType(MefServiceType.Eptree.getName());
+
+        PowerMockito.stub(PowerMockito.method(LegatoUtils.class, "parseNodes", Evc.class)).toReturn(evcDao);
+
+        // then
+        assertEquals(ConnectionType.RootedMultipoint.getName(), evcDao.getConnectionType());
+        assertNotEquals(MefServiceType.Evptree.getName(), evcDao.getSvcType());
+    }
+
+
+
+    @SuppressWarnings({"unchecked", "rawtypes"})
+    @Test
+    public void testDeleteService() throws InterruptedException, ExecutionException {
+
+        // having
+        DeleteConnectivityServiceInput input = new DeleteConnectivityServiceInputBuilder()
+                .setServiceIdOrName(Constants.UUID).build();
+
+        final RpcResult<DeleteConnectivityServiceOutput> rpcResult = mock(RpcResult.class);
+        final ListenableFuture<RpcResult<DeleteConnectivityServiceOutput>> future = mock(ListenableFuture.class);
+
+        when(future.get()).thenReturn(rpcResult);
+        when(rpcResult.isSuccessful()).thenReturn(true);
+        when(prestoConnectivityService.deleteConnectivityService(input)).thenReturn(future);
+
+        // when
+        Future<RpcResult<DeleteConnectivityServiceOutput>> result = this.prestoConnectivityService
+            .deleteConnectivityService(input);
+
+        // then
+        assertTrue(result.get().isSuccessful());
+
+        final InstanceIdentifier<?> evcKey = InstanceIdentifier.create(MefServices.class)
+                .child(CarrierEthernet.class).child(SubscriberServices.class)
+                .child(Evc.class, new EvcKey(new EvcIdType(Constants.EVC_ID_TYPE)));
+
+        when(dataBroker.newWriteOnlyTransaction()).thenReturn(transaction);
+        doNothing().when(transaction).delete(any(LogicalDatastoreType.class), any(InstanceIdentifier.class));
+        when(transaction.commit()).thenReturn(fluentFuture);
+
+        assertEquals(true, LegatoUtils.deleteFromOperationalDB(evcKey, dataBroker));
+
+        verify(transaction).delete(any(LogicalDatastoreType.class), any(InstanceIdentifier.class));
+        verify(transaction).commit();
+        verify(mockAppender).doAppend(argThat(new ArgumentMatcher() {
+            @Override
+            public boolean matches(final Object argument) {
+                return ((LoggingEvent) argument).getFormattedMessage()
+                        .contains("Received a request to delete node");
+            }
+        }));
+
+    }
+
+    @Test
+    public void testDeleteServiceBadInput() throws InterruptedException, ExecutionException {
+
+        // having
+        String uuid = "cs:162052f6bb1:73aaf0f6";
+
+        // when
+        DeleteConnectivityServiceInput input = new DeleteConnectivityServiceInputBuilder()
+            .setServiceIdOrName(Constants.UUID).build();
+
+        // then
+        assertNotEquals(uuid, input.getServiceIdOrName());
+
+    }
+
+}
diff --git a/legato-api/src/test/java/org/opendaylight/unimgr/mef/legato/global/bwp/LegatoBwpDataTreeChangeListenerTest.java b/legato-api/src/test/java/org/opendaylight/unimgr/mef/legato/global/bwp/LegatoBwpDataTreeChangeListenerTest.java
deleted file mode 100644 (file)
index b468942..0000000
+++ /dev/null
@@ -1,174 +0,0 @@
-/*
- * Copyright (c) 2018 Xoriant Corporation and others. All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-
-package org.opendaylight.unimgr.mef.legato.global.bwp;
-import static org.mockito.ArgumentMatchers.any;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.times;
-import static org.mockito.Mockito.verify;
-
-import java.util.ArrayList;
-import java.util.Collection;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.mockito.Mockito;
-import org.opendaylight.mdsal.binding.api.DataObjectModification;
-import org.opendaylight.mdsal.binding.api.DataObjectModification.ModificationType;
-import org.opendaylight.mdsal.binding.api.DataTreeIdentifier;
-import org.opendaylight.mdsal.binding.api.DataTreeModification;
-import org.opendaylight.unimgr.mef.legato.LegatoBwpProfileController;
-import org.opendaylight.yang.gen.v1.urn.mef.yang.mef.global.rev171215.mef.global.bwp.flow.parameter.profiles.Profile;
-import org.opendaylight.yangtools.yang.binding.Augmentation;
-import org.opendaylight.yangtools.yang.binding.ChildOf;
-import org.opendaylight.yangtools.yang.binding.ChoiceIn;
-import org.opendaylight.yangtools.yang.binding.DataObject;
-import org.opendaylight.yangtools.yang.binding.Identifiable;
-import org.opendaylight.yangtools.yang.binding.Identifier;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier.PathArgument;
-import org.powermock.modules.junit4.PowerMockRunner;
-
-/**
- * @author Arif.Hussain@Xoriant.Com
- *
- */
-@RunWith(PowerMockRunner.class)
-public class LegatoBwpDataTreeChangeListenerTest {
-
-    private LegatoBwpProfileController legatoBwpProfileController;
-
-    @Before
-    public void setUp() throws Exception {
-        legatoBwpProfileController = mock(LegatoBwpProfileController.class, Mockito.CALLS_REAL_METHODS);
-    }
-
-    @SuppressWarnings("unchecked")
-    @Test
-    public void testBwpDataTreeChangeListener() {
-        Collection<DataTreeModification<Profile>> collection = new ArrayList<DataTreeModification<Profile>>();
-        DataTreeModification<Profile> profile = getDataTree(ModificationType.WRITE);
-        collection.add(profile);
-        profile = getDataTree(ModificationType.DELETE);
-        collection.add(profile);
-        profile = getDataTree(ModificationType.SUBTREE_MODIFIED);
-        collection.add(profile);
-        legatoBwpProfileController.onDataTreeChanged(collection);
-        verify(legatoBwpProfileController, times(1)).add(any(DataTreeModification.class));
-        verify(legatoBwpProfileController, times(1)).remove(any(DataTreeModification.class));
-        verify(legatoBwpProfileController, times(1)).update(any(DataTreeModification.class));
-    }
-
-    private DataTreeModification<Profile> getDataTree(final ModificationType modificationType) {
-        final DataObjectModification<Profile> proDataObjModification = new DataObjectModification<Profile>() {
-            @Override
-            public Collection<DataObjectModification<? extends DataObject>> getModifiedChildren() {
-                // TODO Auto-generated method stub
-                return null;
-            }
-
-            @Override
-            public <C extends Identifiable<K> & ChildOf<? super Profile>, K extends Identifier<C>> DataObjectModification<C> getModifiedChildListItem(
-                    Class<C> arg0, K arg1) {
-                // TODO Auto-generated method stub
-                return null;
-            }
-
-            @Override
-            public <C extends ChildOf<? super Profile>> DataObjectModification<C> getModifiedChildContainer(Class<C> arg0) {
-                // TODO Auto-generated method stub
-                return null;
-            }
-
-            @Override
-            public DataObjectModification<? extends DataObject> getModifiedChild(PathArgument arg0) {
-                // TODO Auto-generated method stub
-                return null;
-            }
-
-            @Override
-            public <C extends Augmentation<Profile> & DataObject> DataObjectModification<C> getModifiedAugmentation(
-                    Class<C> arg0) {
-                // TODO Auto-generated method stub
-                return null;
-            }
-
-            @Override
-            public ModificationType getModificationType() {
-                return modificationType;
-            }
-
-            @Override
-            public PathArgument getIdentifier() {
-                // TODO Auto-generated method stub
-                return null;
-            }
-
-            @Override
-            public Class<Profile> getDataType() {
-                // TODO Auto-generated method stub
-                return null;
-            }
-
-            @Override
-            public Profile getDataBefore() {
-                // TODO Auto-generated method stub
-                return null;
-            }
-
-            @Override
-            public Profile getDataAfter() {
-                // TODO Auto-generated method stub
-                return null;
-            }
-
-            @Override
-            public <C extends ChildOf<? super Profile>> Collection<DataObjectModification<C>> getModifiedChildren(
-                    Class<C> childType) {
-                // TODO Auto-generated method stub
-                return null;
-            }
-
-            @Override
-            public <H extends ChoiceIn<? super Profile> & DataObject, C extends ChildOf<? super H>> Collection<DataObjectModification<C>> getModifiedChildren(
-                    Class<H> caseType, Class<C> childType) {
-                // TODO Auto-generated method stub
-                return null;
-            }
-
-            @Override
-            public <H extends ChoiceIn<? super Profile> & DataObject, C extends ChildOf<? super H>> DataObjectModification<C> getModifiedChildContainer(
-                    Class<H> caseType, Class<C> child) {
-                // TODO Auto-generated method stub
-                return null;
-            }
-
-            @Override
-            public <H extends ChoiceIn<? super Profile> & DataObject, C extends Identifiable<K> & ChildOf<? super H>, K extends Identifier<C>> DataObjectModification<C> getModifiedChildListItem(
-                    Class<H> caseType, Class<C> listItem, K listKey) {
-                // TODO Auto-generated method stub
-                return null;
-            }
-        };
-
-        DataTreeModification<Profile> modifiedPro = new DataTreeModification<Profile>() {
-            @Override
-            public DataTreeIdentifier<Profile> getRootPath() {
-                return null;
-            }
-
-            @Override
-            public DataObjectModification<Profile> getRootNode() {
-                return proDataObjModification;
-            }
-        };
-
-        return modifiedPro;
-    }
-
-}
diff --git a/legato-api/src/test/java/org/opendaylight/unimgr/mef/legato/global/bwp/LegatoBwpProfileUnitTest.java b/legato-api/src/test/java/org/opendaylight/unimgr/mef/legato/global/bwp/LegatoBwpProfileUnitTest.java
deleted file mode 100644 (file)
index e75dc0f..0000000
+++ /dev/null
@@ -1,144 +0,0 @@
-/*
- * Copyright (c) 2018 Xoriant Corporation and others. All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.unimgr.mef.legato.global.bwp;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.mockito.ArgumentMatchers.any;
-import static org.mockito.Mockito.doNothing;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.when;
-
-import java.util.Optional;
-import java.util.concurrent.ExecutionException;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.mockito.Mock;
-import org.mockito.Mockito;
-import org.opendaylight.mdsal.binding.api.DataBroker;
-import org.opendaylight.mdsal.binding.api.ReadTransaction;
-import org.opendaylight.mdsal.binding.api.WriteTransaction;
-import org.opendaylight.mdsal.common.api.LogicalDatastoreType;
-import org.opendaylight.unimgr.mef.legato.LegatoBwpProfileController;
-import org.opendaylight.unimgr.mef.legato.util.LegatoUtils;
-import org.opendaylight.unimgr.mef.legato.utils.Constants;
-import org.opendaylight.yang.gen.v1.urn.mef.yang.mef.global.rev171215.MefGlobal;
-import org.opendaylight.yang.gen.v1.urn.mef.yang.mef.global.rev171215.mef.global.BwpFlowParameterProfiles;
-import org.opendaylight.yang.gen.v1.urn.mef.yang.mef.global.rev171215.mef.global.bwp.flow.parameter.profiles.Profile;
-import org.opendaylight.yang.gen.v1.urn.mef.yang.mef.global.rev171215.mef.global.bwp.flow.parameter.profiles.ProfileKey;
-import org.opendaylight.yang.gen.v1.urn.mef.yang.mef.types.rev171215.Identifier1024;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import org.powermock.api.mockito.PowerMockito;
-import org.powermock.core.classloader.annotations.PrepareForTest;
-import org.powermock.modules.junit4.PowerMockRunner;
-
-import com.google.common.util.concurrent.FluentFuture;
-
-
-@RunWith(PowerMockRunner.class)
-@PrepareForTest(Optional.class)
-public class LegatoBwpProfileUnitTest {
-
-    @Mock
-    private DataBroker dataBroker;
-    @Mock
-    private WriteTransaction transaction;
-    @SuppressWarnings("rawtypes")
-    @Mock
-    private FluentFuture checkedFuture;
-
-    @Before
-    public void setUp() throws Exception {
-        mock(LegatoBwpProfileController.class, Mockito.CALLS_REAL_METHODS);
-    }
-
-
-    @SuppressWarnings("unchecked")
-    @Test
-    public void testBwpAddToOperationalDB() {
-        final BwpFlowParameterProfiles profile = mock(BwpFlowParameterProfiles.class);
-        final InstanceIdentifier<BwpFlowParameterProfiles> profilesTx =
-                InstanceIdentifier.create(MefGlobal.class).child(BwpFlowParameterProfiles.class);
-
-        when(dataBroker.newWriteOnlyTransaction()).thenReturn(transaction);
-        doNothing().when(transaction).merge(any(LogicalDatastoreType.class),
-                any(InstanceIdentifier.class), any(BwpFlowParameterProfiles.class));
-        when(transaction.commit()).thenReturn(checkedFuture);
-        LegatoUtils.addToOperationalDB(profile, profilesTx, dataBroker);
-        verify(transaction).merge(any(LogicalDatastoreType.class), any(InstanceIdentifier.class),
-                any(BwpFlowParameterProfiles.class));
-        verify(transaction).commit();
-    }
-
-
-    @SuppressWarnings("unchecked")
-    @Test
-    public void testBwpUpdateFromOperationalDB() throws InterruptedException, ExecutionException {
-
-        final InstanceIdentifier<Profile> profileID =
-                InstanceIdentifier.create(MefGlobal.class).child(BwpFlowParameterProfiles.class)
-                        .child(Profile.class, new ProfileKey(new Identifier1024(Constants.ONE)));
-
-        ReadTransaction readTransaction = mock(ReadTransaction.class);
-        when(dataBroker.newReadOnlyTransaction()).thenReturn(readTransaction);
-        FluentFuture<Optional<Profile>> nodeFuture =
-                mock(FluentFuture.class);
-        Optional<Profile> optProfile = PowerMockito.mock(Optional.class);
-        when(readTransaction.read(any(LogicalDatastoreType.class), any(InstanceIdentifier.class)))
-                .thenReturn(nodeFuture);
-        when(nodeFuture.get()).thenReturn(optProfile);
-        Optional<Profile> expectedOpt =
-                LegatoUtils.readProfile(dataBroker, LogicalDatastoreType.CONFIGURATION, profileID, Profile.class);
-        verify(readTransaction).read(any(LogicalDatastoreType.class),
-                any(InstanceIdentifier.class));
-        assertNotNull(expectedOpt);
-        assertEquals(expectedOpt, optProfile);
-
-        when(dataBroker.newWriteOnlyTransaction()).thenReturn(transaction);
-        doNothing().when(transaction).delete(any(LogicalDatastoreType.class),
-                any(InstanceIdentifier.class));
-        when(transaction.commit()).thenReturn(checkedFuture);
-        assertEquals(true, LegatoUtils.deleteFromOperationalDB(profileID, dataBroker));
-        verify(transaction).delete(any(LogicalDatastoreType.class), any(InstanceIdentifier.class));
-        verify(transaction).commit();
-
-        final BwpFlowParameterProfiles bwpProfile = mock(BwpFlowParameterProfiles.class);
-
-        final InstanceIdentifier<BwpFlowParameterProfiles> profilesTx =
-                InstanceIdentifier.create(MefGlobal.class).child(BwpFlowParameterProfiles.class);
-        WriteTransaction transaction2 = Mockito.mock(WriteTransaction.class);
-        when(dataBroker.newWriteOnlyTransaction()).thenReturn(transaction2);
-        doNothing().when(transaction2).merge(any(LogicalDatastoreType.class),
-                any(InstanceIdentifier.class), any(BwpFlowParameterProfiles.class));
-        when(transaction2.commit()).thenReturn(checkedFuture);
-        LegatoUtils.addToOperationalDB(bwpProfile, profilesTx, dataBroker);
-        verify(transaction2).merge(any(LogicalDatastoreType.class), any(InstanceIdentifier.class),
-                any(BwpFlowParameterProfiles.class));
-        verify(transaction2).commit();
-    }
-
-
-    @SuppressWarnings("unchecked")
-    @Test
-    public void testBwpDeleteFromOperationalDB() {
-        final InstanceIdentifier<Profile> profileID =
-                InstanceIdentifier.create(MefGlobal.class).child(BwpFlowParameterProfiles.class)
-                        .child(Profile.class, new ProfileKey(new Identifier1024(Constants.ONE)));
-
-        when(dataBroker.newWriteOnlyTransaction()).thenReturn(transaction);
-        doNothing().when(transaction).delete(any(LogicalDatastoreType.class),
-                any(InstanceIdentifier.class));
-        when(transaction.commit()).thenReturn(checkedFuture);
-        assertEquals(true, LegatoUtils.deleteFromOperationalDB(profileID, dataBroker));
-        verify(transaction).delete(any(LogicalDatastoreType.class), any(InstanceIdentifier.class));
-        verify(transaction).commit();
-    }
-}
diff --git a/legato-api/src/test/java/org/opendaylight/unimgr/mef/legato/global/color/LegatoColorMappingDataTreeChangeListenerTest.java b/legato-api/src/test/java/org/opendaylight/unimgr/mef/legato/global/color/LegatoColorMappingDataTreeChangeListenerTest.java
deleted file mode 100644 (file)
index be8ceec..0000000
+++ /dev/null
@@ -1,174 +0,0 @@
-/*
- * Copyright (c) 2018 Xoriant Corporation and others. All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-
-package org.opendaylight.unimgr.mef.legato.global.color;
-import static org.mockito.ArgumentMatchers.any;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.times;
-import static org.mockito.Mockito.verify;
-
-import java.util.ArrayList;
-import java.util.Collection;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.mockito.Mockito;
-import org.opendaylight.mdsal.binding.api.DataObjectModification;
-import org.opendaylight.mdsal.binding.api.DataObjectModification.ModificationType;
-import org.opendaylight.mdsal.binding.api.DataTreeIdentifier;
-import org.opendaylight.mdsal.binding.api.DataTreeModification;
-import org.opendaylight.unimgr.mef.legato.LegatoColorMappingProfileController;
-import org.opendaylight.yang.gen.v1.urn.mef.yang.mef.global.rev171215.mef.global.color.mapping.profiles.Profile;
-import org.opendaylight.yangtools.yang.binding.Augmentation;
-import org.opendaylight.yangtools.yang.binding.ChildOf;
-import org.opendaylight.yangtools.yang.binding.ChoiceIn;
-import org.opendaylight.yangtools.yang.binding.DataObject;
-import org.opendaylight.yangtools.yang.binding.Identifiable;
-import org.opendaylight.yangtools.yang.binding.Identifier;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier.PathArgument;
-import org.powermock.modules.junit4.PowerMockRunner;
-
-/**
- * @author Arif.Hussain@Xoriant.Com
- *
- */
-@RunWith(PowerMockRunner.class)
-public class LegatoColorMappingDataTreeChangeListenerTest {
-
-    private LegatoColorMappingProfileController legatoColorMappingProfileController;
-
-    @Before
-    public void setUp() throws Exception {
-        legatoColorMappingProfileController = mock(LegatoColorMappingProfileController.class, Mockito.CALLS_REAL_METHODS);
-    }
-
-    @SuppressWarnings("unchecked")
-    @Test
-    public void testColMappingDataTreeChangeListener() {
-        Collection<DataTreeModification<Profile>> collection = new ArrayList<DataTreeModification<Profile>>();
-        DataTreeModification<Profile> profile = getDataTree(ModificationType.WRITE);
-        collection.add(profile);
-        profile = getDataTree(ModificationType.DELETE);
-        collection.add(profile);
-        profile = getDataTree(ModificationType.SUBTREE_MODIFIED);
-        collection.add(profile);
-        legatoColorMappingProfileController.onDataTreeChanged(collection);
-        verify(legatoColorMappingProfileController, times(1)).add(any(DataTreeModification.class));
-        verify(legatoColorMappingProfileController, times(1)).remove(any(DataTreeModification.class));
-        verify(legatoColorMappingProfileController, times(1)).update(any(DataTreeModification.class));
-    }
-
-    private DataTreeModification<Profile> getDataTree(final ModificationType modificationType) {
-        final DataObjectModification<Profile> proDataObjModification = new DataObjectModification<Profile>() {
-            @Override
-            public Collection<DataObjectModification<? extends DataObject>> getModifiedChildren() {
-                // TODO Auto-generated method stub
-                return null;
-            }
-
-            @Override
-            public <C extends Identifiable<K> & ChildOf<? super Profile>, K extends Identifier<C>> DataObjectModification<C> getModifiedChildListItem(
-                    Class<C> arg0, K arg1) {
-                // TODO Auto-generated method stub
-                return null;
-            }
-
-            @Override
-            public <C extends ChildOf<? super Profile>> DataObjectModification<C> getModifiedChildContainer(Class<C> arg0) {
-                // TODO Auto-generated method stub
-                return null;
-            }
-
-            @Override
-            public DataObjectModification<? extends DataObject> getModifiedChild(PathArgument arg0) {
-                // TODO Auto-generated method stub
-                return null;
-            }
-
-            @Override
-            public <C extends Augmentation<Profile> & DataObject> DataObjectModification<C> getModifiedAugmentation(
-                    Class<C> arg0) {
-                // TODO Auto-generated method stub
-                return null;
-            }
-
-            @Override
-            public ModificationType getModificationType() {
-                return modificationType;
-            }
-
-            @Override
-            public PathArgument getIdentifier() {
-                // TODO Auto-generated method stub
-                return null;
-            }
-
-            @Override
-            public Class<Profile> getDataType() {
-                // TODO Auto-generated method stub
-                return null;
-            }
-
-            @Override
-            public Profile getDataBefore() {
-                // TODO Auto-generated method stub
-                return null;
-            }
-
-            @Override
-            public Profile getDataAfter() {
-                // TODO Auto-generated method stub
-                return null;
-            }
-
-            @Override
-            public <C extends ChildOf<? super Profile>> Collection<DataObjectModification<C>> getModifiedChildren(
-                    Class<C> childType) {
-                // TODO Auto-generated method stub
-                return null;
-            }
-
-            @Override
-            public <H extends ChoiceIn<? super Profile> & DataObject, C extends ChildOf<? super H>> Collection<DataObjectModification<C>> getModifiedChildren(
-                    Class<H> caseType, Class<C> childType) {
-                // TODO Auto-generated method stub
-                return null;
-            }
-
-            @Override
-            public <H extends ChoiceIn<? super Profile> & DataObject, C extends ChildOf<? super H>> DataObjectModification<C> getModifiedChildContainer(
-                    Class<H> caseType, Class<C> child) {
-                // TODO Auto-generated method stub
-                return null;
-            }
-
-            @Override
-            public <H extends ChoiceIn<? super Profile> & DataObject, C extends Identifiable<K> & ChildOf<? super H>, K extends Identifier<C>> DataObjectModification<C> getModifiedChildListItem(
-                    Class<H> caseType, Class<C> listItem, K listKey) {
-                // TODO Auto-generated method stub
-                return null;
-            }
-        };
-
-        DataTreeModification<Profile> modifiedPro = new DataTreeModification<Profile>() {
-            @Override
-            public DataTreeIdentifier<Profile> getRootPath() {
-                return null;
-            }
-
-            @Override
-            public DataObjectModification<Profile> getRootNode() {
-                return proDataObjModification;
-            }
-        };
-
-        return modifiedPro;
-    }
-
-}
diff --git a/legato-api/src/test/java/org/opendaylight/unimgr/mef/legato/global/color/LegatoColorMappingProfileUnitTest.java b/legato-api/src/test/java/org/opendaylight/unimgr/mef/legato/global/color/LegatoColorMappingProfileUnitTest.java
deleted file mode 100644 (file)
index a314857..0000000
+++ /dev/null
@@ -1,143 +0,0 @@
-/*
- * Copyright (c) 2018 Xoriant Corporation and others. All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.unimgr.mef.legato.global.color;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.mockito.ArgumentMatchers.any;
-import static org.mockito.Mockito.doNothing;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.when;
-
-import java.util.Optional;
-import java.util.concurrent.ExecutionException;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.mockito.Mock;
-import org.mockito.Mockito;
-import org.opendaylight.mdsal.binding.api.DataBroker;
-import org.opendaylight.mdsal.binding.api.ReadTransaction;
-import org.opendaylight.mdsal.binding.api.WriteTransaction;
-import org.opendaylight.mdsal.common.api.LogicalDatastoreType;
-import org.opendaylight.unimgr.mef.legato.LegatoColorMappingProfileController;
-import org.opendaylight.unimgr.mef.legato.util.LegatoConstants;
-import org.opendaylight.unimgr.mef.legato.util.LegatoUtils;
-import org.opendaylight.unimgr.mef.legato.utils.Constants;
-import org.opendaylight.yang.gen.v1.urn.mef.yang.mef.global.rev171215.MefGlobal;
-import org.opendaylight.yang.gen.v1.urn.mef.yang.mef.global.rev171215.mef.global.ColorMappingProfiles;
-import org.opendaylight.yang.gen.v1.urn.mef.yang.mef.global.rev171215.mef.global.color.mapping.profiles.Profile;
-import org.opendaylight.yang.gen.v1.urn.mef.yang.mef.global.rev171215.mef.global.color.mapping.profiles.ProfileKey;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import org.powermock.api.mockito.PowerMockito;
-import org.powermock.core.classloader.annotations.PrepareForTest;
-import org.powermock.modules.junit4.PowerMockRunner;
-
-import com.google.common.util.concurrent.FluentFuture;
-
-
-@RunWith(PowerMockRunner.class)
-@PrepareForTest(Optional.class)
-public class LegatoColorMappingProfileUnitTest {
-
-    @Mock
-    private DataBroker dataBroker;
-    @Mock
-    private WriteTransaction transaction;
-    @SuppressWarnings("rawtypes")
-    @Mock
-    private FluentFuture checkedFuture;
-
-    @Before
-    public void setUp() throws Exception {
-        mock(LegatoColorMappingProfileController.class, Mockito.CALLS_REAL_METHODS);
-    }
-
-    @SuppressWarnings("unchecked")
-    @Test
-    public void testColMappingAddToOperationalDB() {
-        final ColorMappingProfiles colorMappingProfiles = mock(ColorMappingProfiles.class);
-        final InstanceIdentifier<ColorMappingProfiles> instanceIdentifier =
-                InstanceIdentifier.create(MefGlobal.class).child(ColorMappingProfiles.class);
-
-        when(dataBroker.newWriteOnlyTransaction()).thenReturn(transaction);
-        doNothing().when(transaction).merge(any(LogicalDatastoreType.class),
-                any(InstanceIdentifier.class), any(ColorMappingProfiles.class));
-        when(transaction.commit()).thenReturn(checkedFuture);
-        LegatoUtils.addToOperationalDB(colorMappingProfiles, instanceIdentifier, dataBroker);
-        verify(transaction).merge(any(LogicalDatastoreType.class), any(InstanceIdentifier.class),
-                any(ColorMappingProfiles.class));
-        verify(transaction).commit();
-    }
-
-
-    @SuppressWarnings("unchecked")
-    @Test
-    public void testColMappingUpdateFromOperationalDB() throws InterruptedException, ExecutionException {
-        final InstanceIdentifier<Profile> profileID =
-                InstanceIdentifier.create(MefGlobal.class).child(ColorMappingProfiles.class)
-                        .child(Profile.class, new ProfileKey(Constants.ONE));
-        ReadTransaction readTransaction = mock(ReadTransaction.class);
-        when(dataBroker.newReadOnlyTransaction()).thenReturn(readTransaction);
-        FluentFuture<Optional<Profile>> proFuture = mock(FluentFuture.class);
-
-        Optional<Profile> optProfile = PowerMockito.mock(Optional.class);
-        when(readTransaction.read(any(LogicalDatastoreType.class), any(InstanceIdentifier.class)))
-                .thenReturn(proFuture);
-        when(proFuture.get()).thenReturn(optProfile);
-
-        Optional<Profile> expectedOpt =
-                (Optional<Profile>) LegatoUtils.readProfile(LegatoConstants.CMP_PROFILES,
-                        dataBroker, LogicalDatastoreType.CONFIGURATION, profileID);
-        verify(readTransaction).read(any(LogicalDatastoreType.class),
-                any(InstanceIdentifier.class));
-        assertNotNull(expectedOpt);
-        assertEquals(expectedOpt, optProfile);
-
-        when(dataBroker.newWriteOnlyTransaction()).thenReturn(transaction);
-        doNothing().when(transaction).delete(any(LogicalDatastoreType.class),
-                any(InstanceIdentifier.class));
-        when(transaction.commit()).thenReturn(checkedFuture);
-        assertEquals(true, LegatoUtils.deleteFromOperationalDB(profileID, dataBroker));
-        verify(transaction).delete(any(LogicalDatastoreType.class), any(InstanceIdentifier.class));
-        verify(transaction).commit();
-
-
-        final ColorMappingProfiles colorMappingProfiles = mock(ColorMappingProfiles.class);
-        final InstanceIdentifier<ColorMappingProfiles> instanceIdentifier =
-                InstanceIdentifier.create(MefGlobal.class).child(ColorMappingProfiles.class);
-        WriteTransaction transaction2 = Mockito.mock(WriteTransaction.class);
-        when(dataBroker.newWriteOnlyTransaction()).thenReturn(transaction2);
-        doNothing().when(transaction2).merge(any(LogicalDatastoreType.class),
-                any(InstanceIdentifier.class), any(ColorMappingProfiles.class));
-        when(transaction2.commit()).thenReturn(checkedFuture);
-        LegatoUtils.addToOperationalDB(colorMappingProfiles, instanceIdentifier, dataBroker);
-        verify(transaction2).merge(any(LogicalDatastoreType.class), any(InstanceIdentifier.class),
-                any(ColorMappingProfiles.class));
-        verify(transaction2).commit();
-    }
-
-
-    @SuppressWarnings("unchecked")
-    @Test
-    public void testColMappingDeleteFromOperationalDB() {
-        final InstanceIdentifier<Profile> profileID =
-                InstanceIdentifier.create(MefGlobal.class).child(ColorMappingProfiles.class)
-                        .child(Profile.class, new ProfileKey(Constants.ONE));
-        when(dataBroker.newWriteOnlyTransaction()).thenReturn(transaction);
-        doNothing().when(transaction).delete(any(LogicalDatastoreType.class),
-                any(InstanceIdentifier.class));
-        when(transaction.commit()).thenReturn(checkedFuture);
-        assertEquals(true, LegatoUtils.deleteFromOperationalDB(profileID, dataBroker));
-        verify(transaction).delete(any(LogicalDatastoreType.class), any(InstanceIdentifier.class));
-        verify(transaction).commit();
-    }
-
-}
diff --git a/legato-api/src/test/java/org/opendaylight/unimgr/mef/legato/global/cos/LegatoCosProfileDataTreeChangeListenerTest.java b/legato-api/src/test/java/org/opendaylight/unimgr/mef/legato/global/cos/LegatoCosProfileDataTreeChangeListenerTest.java
deleted file mode 100644 (file)
index 306a7eb..0000000
+++ /dev/null
@@ -1,174 +0,0 @@
-/*
- * Copyright (c) 2018 Xoriant Corporation and others. All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-
-package org.opendaylight.unimgr.mef.legato.global.cos;
-import static org.mockito.ArgumentMatchers.any;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.times;
-import static org.mockito.Mockito.verify;
-
-import java.util.ArrayList;
-import java.util.Collection;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.mockito.Mockito;
-import org.opendaylight.mdsal.binding.api.DataObjectModification;
-import org.opendaylight.mdsal.binding.api.DataObjectModification.ModificationType;
-import org.opendaylight.mdsal.binding.api.DataTreeIdentifier;
-import org.opendaylight.mdsal.binding.api.DataTreeModification;
-import org.opendaylight.unimgr.mef.legato.LegatoCosProfileController;
-import org.opendaylight.yang.gen.v1.urn.mef.yang.mef.global.rev171215.mef.global.cos.profiles.Profile;
-import org.opendaylight.yangtools.yang.binding.Augmentation;
-import org.opendaylight.yangtools.yang.binding.ChildOf;
-import org.opendaylight.yangtools.yang.binding.ChoiceIn;
-import org.opendaylight.yangtools.yang.binding.DataObject;
-import org.opendaylight.yangtools.yang.binding.Identifiable;
-import org.opendaylight.yangtools.yang.binding.Identifier;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier.PathArgument;
-import org.powermock.modules.junit4.PowerMockRunner;
-
-/**
- * @author Arif.Hussain@Xoriant.Com
- *
- */
-@RunWith(PowerMockRunner.class)
-public class LegatoCosProfileDataTreeChangeListenerTest {
-
-    private LegatoCosProfileController legatoCosProfileController;
-
-    @Before
-    public void setUp() throws Exception {
-        legatoCosProfileController = mock(LegatoCosProfileController.class, Mockito.CALLS_REAL_METHODS);
-    }
-
-    @SuppressWarnings("unchecked")
-    @Test
-    public void testCosProfileDataTreeChangeListener() {
-        Collection<DataTreeModification<Profile>> collection = new ArrayList<DataTreeModification<Profile>>();
-        DataTreeModification<Profile> profile = getDataTree(ModificationType.WRITE);
-        collection.add(profile);
-        profile = getDataTree(ModificationType.DELETE);
-        collection.add(profile);
-        profile = getDataTree(ModificationType.SUBTREE_MODIFIED);
-        collection.add(profile);
-        legatoCosProfileController.onDataTreeChanged(collection);
-        verify(legatoCosProfileController, times(1)).add(any(DataTreeModification.class));
-        verify(legatoCosProfileController, times(1)).remove(any(DataTreeModification.class));
-        verify(legatoCosProfileController, times(1)).update(any(DataTreeModification.class));
-    }
-
-    private DataTreeModification<Profile> getDataTree(final ModificationType modificationType) {
-        final DataObjectModification<Profile> proDataObjModification = new DataObjectModification<Profile>() {
-            @Override
-            public Collection<DataObjectModification<? extends DataObject>> getModifiedChildren() {
-                // TODO Auto-generated method stub
-                return null;
-            }
-
-            @Override
-            public <C extends Identifiable<K> & ChildOf<? super Profile>, K extends Identifier<C>> DataObjectModification<C> getModifiedChildListItem(
-                    Class<C> arg0, K arg1) {
-                // TODO Auto-generated method stub
-                return null;
-            }
-
-            @Override
-            public <C extends ChildOf<? super Profile>> DataObjectModification<C> getModifiedChildContainer(Class<C> arg0) {
-                // TODO Auto-generated method stub
-                return null;
-            }
-
-            @Override
-            public DataObjectModification<? extends DataObject> getModifiedChild(PathArgument arg0) {
-                // TODO Auto-generated method stub
-                return null;
-            }
-
-            @Override
-            public <C extends Augmentation<Profile> & DataObject> DataObjectModification<C> getModifiedAugmentation(
-                    Class<C> arg0) {
-                // TODO Auto-generated method stub
-                return null;
-            }
-
-            @Override
-            public ModificationType getModificationType() {
-                return modificationType;
-            }
-
-            @Override
-            public PathArgument getIdentifier() {
-                // TODO Auto-generated method stub
-                return null;
-            }
-
-            @Override
-            public Class<Profile> getDataType() {
-                // TODO Auto-generated method stub
-                return null;
-            }
-
-            @Override
-            public Profile getDataBefore() {
-                // TODO Auto-generated method stub
-                return null;
-            }
-
-            @Override
-            public Profile getDataAfter() {
-                // TODO Auto-generated method stub
-                return null;
-            }
-
-            @Override
-            public <C extends ChildOf<? super Profile>> Collection<DataObjectModification<C>> getModifiedChildren(
-                    Class<C> childType) {
-                // TODO Auto-generated method stub
-                return null;
-            }
-
-            @Override
-            public <H extends ChoiceIn<? super Profile> & DataObject, C extends ChildOf<? super H>> Collection<DataObjectModification<C>> getModifiedChildren(
-                    Class<H> caseType, Class<C> childType) {
-                // TODO Auto-generated method stub
-                return null;
-            }
-
-            @Override
-            public <H extends ChoiceIn<? super Profile> & DataObject, C extends ChildOf<? super H>> DataObjectModification<C> getModifiedChildContainer(
-                    Class<H> caseType, Class<C> child) {
-                // TODO Auto-generated method stub
-                return null;
-            }
-
-            @Override
-            public <H extends ChoiceIn<? super Profile> & DataObject, C extends Identifiable<K> & ChildOf<? super H>, K extends Identifier<C>> DataObjectModification<C> getModifiedChildListItem(
-                    Class<H> caseType, Class<C> listItem, K listKey) {
-                // TODO Auto-generated method stub
-                return null;
-            }
-        };
-
-        DataTreeModification<Profile> modifiedPro = new DataTreeModification<Profile>() {
-            @Override
-            public DataTreeIdentifier<Profile> getRootPath() {
-                return null;
-            }
-
-            @Override
-            public DataObjectModification<Profile> getRootNode() {
-                return proDataObjModification;
-            }
-        };
-
-        return modifiedPro;
-    }
-
-}
diff --git a/legato-api/src/test/java/org/opendaylight/unimgr/mef/legato/global/cos/LegatoCosProfileUnitTest.java b/legato-api/src/test/java/org/opendaylight/unimgr/mef/legato/global/cos/LegatoCosProfileUnitTest.java
deleted file mode 100644 (file)
index 5ce7dd1..0000000
+++ /dev/null
@@ -1,147 +0,0 @@
-/*
- * Copyright (c) 2018 Xoriant Corporation and others. All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.unimgr.mef.legato.global.cos;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.mockito.ArgumentMatchers.any;
-import static org.mockito.Mockito.doNothing;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.when;
-
-import java.util.Optional;
-import java.util.concurrent.ExecutionException;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.mockito.Mock;
-import org.mockito.Mockito;
-import org.opendaylight.mdsal.binding.api.DataBroker;
-import org.opendaylight.mdsal.binding.api.ReadTransaction;
-import org.opendaylight.mdsal.binding.api.WriteTransaction;
-import org.opendaylight.mdsal.common.api.LogicalDatastoreType;
-import org.opendaylight.unimgr.mef.legato.LegatoCosProfileController;
-import org.opendaylight.unimgr.mef.legato.util.LegatoConstants;
-import org.opendaylight.unimgr.mef.legato.util.LegatoUtils;
-import org.opendaylight.unimgr.mef.legato.utils.Constants;
-import org.opendaylight.yang.gen.v1.urn.mef.yang.mef.global.rev171215.MefGlobal;
-import org.opendaylight.yang.gen.v1.urn.mef.yang.mef.global.rev171215.mef.global.CosProfiles;
-import org.opendaylight.yang.gen.v1.urn.mef.yang.mef.global.rev171215.mef.global.cos.profiles.Profile;
-import org.opendaylight.yang.gen.v1.urn.mef.yang.mef.global.rev171215.mef.global.cos.profiles.ProfileKey;
-import org.opendaylight.yang.gen.v1.urn.mef.yang.mef.types.rev171215.Identifier1024;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import org.powermock.api.mockito.PowerMockito;
-import org.powermock.core.classloader.annotations.PrepareForTest;
-import org.powermock.modules.junit4.PowerMockRunner;
-
-import com.google.common.util.concurrent.FluentFuture;
-
-
-@RunWith(PowerMockRunner.class)
-@PrepareForTest(Optional.class)
-public class LegatoCosProfileUnitTest {
-
-    @Mock
-    private DataBroker dataBroker;
-    @Mock
-    private WriteTransaction transaction;
-    @SuppressWarnings("rawtypes")
-    @Mock
-    private FluentFuture checkedFuture;
-
-    @Before
-    public void setUp() throws Exception {
-        mock(LegatoCosProfileController.class, Mockito.CALLS_REAL_METHODS);
-    }
-
-
-    @SuppressWarnings("unchecked")
-    @Test
-    public void testCosProfileAddToOperationalDB() {
-        final CosProfiles cosProfiles = mock(CosProfiles.class);
-        final InstanceIdentifier<CosProfiles> instanceIdentifier =
-                InstanceIdentifier.create(MefGlobal.class).child(CosProfiles.class);
-
-        when(dataBroker.newWriteOnlyTransaction()).thenReturn(transaction);
-        doNothing().when(transaction).merge(any(LogicalDatastoreType.class),
-                any(InstanceIdentifier.class), any(CosProfiles.class));
-        when(transaction.commit()).thenReturn(checkedFuture);
-        LegatoUtils.addToOperationalDB(cosProfiles, instanceIdentifier, dataBroker);
-        verify(transaction).merge(any(LogicalDatastoreType.class), any(InstanceIdentifier.class),
-                any(CosProfiles.class));
-        verify(transaction).commit();
-    }
-
-    @SuppressWarnings("unchecked")
-    @Test
-    public void testCosProfileUpdateFromOperationalDB() throws InterruptedException, ExecutionException {
-        final InstanceIdentifier<Profile> profileID =
-                InstanceIdentifier.create(MefGlobal.class).child(CosProfiles.class)
-                        .child(Profile.class, new ProfileKey(new Identifier1024(Constants.ONE)));
-
-        ReadTransaction readTransaction = mock(ReadTransaction.class);
-        when(dataBroker.newReadOnlyTransaction()).thenReturn(readTransaction);
-        FluentFuture<Optional<Profile>> proFuture = mock(FluentFuture.class);
-
-        Optional<Profile> optProfile = PowerMockito.mock(Optional.class);
-        when(readTransaction.read(any(LogicalDatastoreType.class), any(InstanceIdentifier.class)))
-                .thenReturn(proFuture);
-        when(proFuture.get()).thenReturn(optProfile);
-
-        Optional<Profile> expectedOpt =
-                (Optional<Profile>) LegatoUtils.readProfile(LegatoConstants.COS_PROFILES,
-                        dataBroker, LogicalDatastoreType.CONFIGURATION, profileID);
-        verify(readTransaction).read(any(LogicalDatastoreType.class),
-                any(InstanceIdentifier.class));
-        assertNotNull(expectedOpt);
-        assertEquals(expectedOpt, optProfile);
-
-        when(dataBroker.newWriteOnlyTransaction()).thenReturn(transaction);
-        doNothing().when(transaction).delete(any(LogicalDatastoreType.class),
-                any(InstanceIdentifier.class));
-        when(transaction.commit()).thenReturn(checkedFuture);
-        assertEquals(true, LegatoUtils.deleteFromOperationalDB(profileID, dataBroker));
-        verify(transaction).delete(any(LogicalDatastoreType.class), any(InstanceIdentifier.class));
-        verify(transaction).commit();
-
-        final CosProfiles cosProfiles = mock(CosProfiles.class);
-        final InstanceIdentifier<CosProfiles> instanceIdentifier =
-                InstanceIdentifier.create(MefGlobal.class).child(CosProfiles.class);
-
-        WriteTransaction transaction2 = Mockito.mock(WriteTransaction.class);
-        when(dataBroker.newWriteOnlyTransaction()).thenReturn(transaction2);
-        doNothing().when(transaction2).merge(any(LogicalDatastoreType.class),
-                any(InstanceIdentifier.class), any(CosProfiles.class));
-        when(transaction2.commit()).thenReturn(checkedFuture);
-        LegatoUtils.addToOperationalDB(cosProfiles, instanceIdentifier, dataBroker);
-        verify(transaction2).merge(any(LogicalDatastoreType.class), any(InstanceIdentifier.class),
-                any(CosProfiles.class));
-        verify(transaction2).commit();
-    }
-
-
-    @SuppressWarnings("unchecked")
-    @Test
-    public void testCosProfileDeleteFromOperationalDB() {
-
-        final InstanceIdentifier<Profile> profileID =
-                InstanceIdentifier.create(MefGlobal.class).child(CosProfiles.class)
-                        .child(Profile.class, new ProfileKey(new Identifier1024(Constants.ONE)));
-
-        when(dataBroker.newWriteOnlyTransaction()).thenReturn(transaction);
-        doNothing().when(transaction).delete(any(LogicalDatastoreType.class),
-                any(InstanceIdentifier.class));
-        when(transaction.commit()).thenReturn(checkedFuture);
-        assertEquals(true, LegatoUtils.deleteFromOperationalDB(profileID, dataBroker));
-        verify(transaction).delete(any(LogicalDatastoreType.class), any(InstanceIdentifier.class));
-        verify(transaction).commit();
-
-    }
-}
diff --git a/legato-api/src/test/java/org/opendaylight/unimgr/mef/legato/global/eec/LegatoEecProfileDataTreeChangeListenerTest.java b/legato-api/src/test/java/org/opendaylight/unimgr/mef/legato/global/eec/LegatoEecProfileDataTreeChangeListenerTest.java
deleted file mode 100644 (file)
index 2b6d857..0000000
+++ /dev/null
@@ -1,175 +0,0 @@
-/*
- * Copyright (c) 2018 Xoriant Corporation and others. All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-
-package org.opendaylight.unimgr.mef.legato.global.eec;
-import static org.mockito.ArgumentMatchers.any;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.times;
-import static org.mockito.Mockito.verify;
-
-import java.util.ArrayList;
-import java.util.Collection;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.mockito.Mockito;
-import org.opendaylight.mdsal.binding.api.DataObjectModification;
-import org.opendaylight.mdsal.binding.api.DataObjectModification.ModificationType;
-import org.opendaylight.mdsal.binding.api.DataTreeIdentifier;
-import org.opendaylight.mdsal.binding.api.DataTreeModification;
-import org.opendaylight.unimgr.mef.legato.LegatoEecProfileController;
-import org.opendaylight.yang.gen.v1.urn.mef.yang.mef.global.rev171215.mef.global.eec.profiles.Profile;
-import org.opendaylight.yangtools.yang.binding.Augmentation;
-import org.opendaylight.yangtools.yang.binding.ChildOf;
-import org.opendaylight.yangtools.yang.binding.ChoiceIn;
-import org.opendaylight.yangtools.yang.binding.DataObject;
-import org.opendaylight.yangtools.yang.binding.Identifiable;
-import org.opendaylight.yangtools.yang.binding.Identifier;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier.PathArgument;
-import org.powermock.modules.junit4.PowerMockRunner;
-
-/**
- * @author Arif.Hussain@Xoriant.Com
- *
- */
-@RunWith(PowerMockRunner.class)
-public class LegatoEecProfileDataTreeChangeListenerTest {
-
-    private LegatoEecProfileController legatoEecProfileController;
-
-    @Before
-    public void setUp() throws Exception {
-        legatoEecProfileController = mock(LegatoEecProfileController.class, Mockito.CALLS_REAL_METHODS);
-    }
-
-    @SuppressWarnings("unchecked")
-    @Test
-    public void testEecProfileDataTreeChangeListener() {
-        Collection<DataTreeModification<Profile>> collection = new ArrayList<DataTreeModification<Profile>>();
-        DataTreeModification<Profile> profile = getDataTree(ModificationType.WRITE);
-        collection.add(profile);
-        profile = getDataTree(ModificationType.DELETE);
-        collection.add(profile);
-        profile = getDataTree(ModificationType.SUBTREE_MODIFIED);
-        collection.add(profile);
-        legatoEecProfileController.onDataTreeChanged(collection);
-        verify(legatoEecProfileController, times(1)).add(any(DataTreeModification.class));
-        verify(legatoEecProfileController, times(1)).remove(any(DataTreeModification.class));
-        verify(legatoEecProfileController, times(1)).update(any(DataTreeModification.class));
-    }
-
-
-    private DataTreeModification<Profile> getDataTree(final ModificationType modificationType) {
-        final DataObjectModification<Profile> proDataObjModification = new DataObjectModification<Profile>() {
-            @Override
-            public Collection<DataObjectModification<? extends DataObject>> getModifiedChildren() {
-                // TODO Auto-generated method stub
-                return null;
-            }
-
-            @Override
-            public <C extends Identifiable<K> & ChildOf<? super Profile>, K extends Identifier<C>> DataObjectModification<C> getModifiedChildListItem(
-                    Class<C> arg0, K arg1) {
-                // TODO Auto-generated method stub
-                return null;
-            }
-
-            @Override
-            public <C extends ChildOf<? super Profile>> DataObjectModification<C> getModifiedChildContainer(Class<C> arg0) {
-                // TODO Auto-generated method stub
-                return null;
-            }
-
-            @Override
-            public DataObjectModification<? extends DataObject> getModifiedChild(PathArgument arg0) {
-                // TODO Auto-generated method stub
-                return null;
-            }
-
-            @Override
-            public <C extends Augmentation<Profile> & DataObject> DataObjectModification<C> getModifiedAugmentation(
-                    Class<C> arg0) {
-                // TODO Auto-generated method stub
-                return null;
-            }
-
-            @Override
-            public ModificationType getModificationType() {
-                return modificationType;
-            }
-
-            @Override
-            public PathArgument getIdentifier() {
-                // TODO Auto-generated method stub
-                return null;
-            }
-
-            @Override
-            public Class<Profile> getDataType() {
-                // TODO Auto-generated method stub
-                return null;
-            }
-
-            @Override
-            public Profile getDataBefore() {
-                // TODO Auto-generated method stub
-                return null;
-            }
-
-            @Override
-            public Profile getDataAfter() {
-                // TODO Auto-generated method stub
-                return null;
-            }
-
-            @Override
-            public <C extends ChildOf<? super Profile>> Collection<DataObjectModification<C>> getModifiedChildren(
-                    Class<C> childType) {
-                // TODO Auto-generated method stub
-                return null;
-            }
-
-            @Override
-            public <H extends ChoiceIn<? super Profile> & DataObject, C extends ChildOf<? super H>> Collection<DataObjectModification<C>> getModifiedChildren(
-                    Class<H> caseType, Class<C> childType) {
-                // TODO Auto-generated method stub
-                return null;
-            }
-
-            @Override
-            public <H extends ChoiceIn<? super Profile> & DataObject, C extends ChildOf<? super H>> DataObjectModification<C> getModifiedChildContainer(
-                    Class<H> caseType, Class<C> child) {
-                // TODO Auto-generated method stub
-                return null;
-            }
-
-            @Override
-            public <H extends ChoiceIn<? super Profile> & DataObject, C extends Identifiable<K> & ChildOf<? super H>, K extends Identifier<C>> DataObjectModification<C> getModifiedChildListItem(
-                    Class<H> caseType, Class<C> listItem, K listKey) {
-                // TODO Auto-generated method stub
-                return null;
-            }
-        };
-
-        DataTreeModification<Profile> modifiedPro = new DataTreeModification<Profile>() {
-            @Override
-            public DataTreeIdentifier<Profile> getRootPath() {
-                return null;
-            }
-
-            @Override
-            public DataObjectModification<Profile> getRootNode() {
-                return proDataObjModification;
-            }
-        };
-
-        return modifiedPro;
-    }
-
-}
\ No newline at end of file
diff --git a/legato-api/src/test/java/org/opendaylight/unimgr/mef/legato/global/eec/LegatoEecProfileUnitTest.java b/legato-api/src/test/java/org/opendaylight/unimgr/mef/legato/global/eec/LegatoEecProfileUnitTest.java
deleted file mode 100644 (file)
index 1a719ad..0000000
+++ /dev/null
@@ -1,147 +0,0 @@
-/*
- * Copyright (c) 2018 Xoriant Corporation and others. All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.unimgr.mef.legato.global.eec;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.mockito.ArgumentMatchers.any;
-import static org.mockito.Mockito.doNothing;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.when;
-
-import java.util.Optional;
-import java.util.concurrent.ExecutionException;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.mockito.Mock;
-import org.mockito.Mockito;
-import org.opendaylight.mdsal.binding.api.DataBroker;
-import org.opendaylight.mdsal.binding.api.ReadTransaction;
-import org.opendaylight.mdsal.binding.api.WriteTransaction;
-import org.opendaylight.mdsal.common.api.LogicalDatastoreType;
-import org.opendaylight.unimgr.mef.legato.LegatoEecProfileController;
-import org.opendaylight.unimgr.mef.legato.util.LegatoConstants;
-import org.opendaylight.unimgr.mef.legato.util.LegatoUtils;
-import org.opendaylight.unimgr.mef.legato.utils.Constants;
-import org.opendaylight.yang.gen.v1.urn.mef.yang.mef.global.rev171215.MefGlobal;
-import org.opendaylight.yang.gen.v1.urn.mef.yang.mef.global.rev171215.mef.global.EecProfiles;
-import org.opendaylight.yang.gen.v1.urn.mef.yang.mef.global.rev171215.mef.global.eec.profiles.Profile;
-import org.opendaylight.yang.gen.v1.urn.mef.yang.mef.global.rev171215.mef.global.eec.profiles.ProfileKey;
-import org.opendaylight.yang.gen.v1.urn.mef.yang.mef.types.rev171215.Identifier1024;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import org.powermock.api.mockito.PowerMockito;
-import org.powermock.core.classloader.annotations.PrepareForTest;
-import org.powermock.modules.junit4.PowerMockRunner;
-
-import com.google.common.util.concurrent.FluentFuture;
-
-
-@RunWith(PowerMockRunner.class)
-@PrepareForTest(Optional.class)
-public class LegatoEecProfileUnitTest {
-
-    @Mock
-    private DataBroker dataBroker;
-    @Mock
-    private WriteTransaction transaction;
-    @SuppressWarnings("rawtypes")
-    @Mock
-    private FluentFuture checkedFuture;
-
-    @Before
-    public void setUp() throws Exception {
-        mock(LegatoEecProfileController.class, Mockito.CALLS_REAL_METHODS);
-    }
-
-    @SuppressWarnings("unchecked")
-    @Test
-    public void testEecProfileAddToOperationalDB() {
-        final EecProfiles eecProfiles = mock(EecProfiles.class);
-        final InstanceIdentifier<EecProfiles> instanceIdentifier =
-                InstanceIdentifier.create(MefGlobal.class).child(EecProfiles.class);
-
-        when(dataBroker.newWriteOnlyTransaction()).thenReturn(transaction);
-        doNothing().when(transaction).merge(any(LogicalDatastoreType.class),
-                any(InstanceIdentifier.class), any(EecProfiles.class));
-        when(transaction.commit()).thenReturn(checkedFuture);
-        LegatoUtils.addToOperationalDB(eecProfiles, instanceIdentifier, dataBroker);
-        verify(transaction).merge(any(LogicalDatastoreType.class), any(InstanceIdentifier.class),
-                any(EecProfiles.class));
-        verify(transaction).commit();
-    }
-
-
-    @SuppressWarnings("unchecked")
-    @Test
-    public void testEecProfileUpdateFromOperationalDB() throws InterruptedException, ExecutionException {
-        final InstanceIdentifier<Profile> profileID =
-                InstanceIdentifier.create(MefGlobal.class).child(EecProfiles.class)
-                        .child(Profile.class, new ProfileKey(new Identifier1024(Constants.ONE)));
-
-        ReadTransaction readTransaction = mock(ReadTransaction.class);
-        when(dataBroker.newReadOnlyTransaction()).thenReturn(readTransaction);
-        FluentFuture<Optional<Profile>> proFuture = mock(FluentFuture.class);
-
-        Optional<Profile> optProfile = PowerMockito.mock(Optional.class);
-        when(readTransaction.read(any(LogicalDatastoreType.class), any(InstanceIdentifier.class)))
-                .thenReturn(proFuture);
-        when(proFuture.get()).thenReturn(optProfile);
-
-        Optional<Profile> expectedOpt =
-                (Optional<Profile>) LegatoUtils.readProfile(LegatoConstants.EEC_PROFILES,
-                        dataBroker, LogicalDatastoreType.CONFIGURATION, profileID);
-        verify(readTransaction).read(any(LogicalDatastoreType.class),
-                any(InstanceIdentifier.class));
-        assertNotNull(expectedOpt);
-        assertEquals(expectedOpt, optProfile);
-
-        when(dataBroker.newWriteOnlyTransaction()).thenReturn(transaction);
-        doNothing().when(transaction).delete(any(LogicalDatastoreType.class),
-                any(InstanceIdentifier.class));
-        when(transaction.commit()).thenReturn(checkedFuture);
-        assertEquals(true, LegatoUtils.deleteFromOperationalDB(profileID, dataBroker));
-        verify(transaction).delete(any(LogicalDatastoreType.class), any(InstanceIdentifier.class));
-        verify(transaction).commit();
-
-        final EecProfiles eecProfiles = mock(EecProfiles.class);
-        final InstanceIdentifier<EecProfiles> instanceIdentifier =
-                InstanceIdentifier.create(MefGlobal.class).child(EecProfiles.class);
-
-        WriteTransaction transaction2 = Mockito.mock(WriteTransaction.class);
-        when(dataBroker.newWriteOnlyTransaction()).thenReturn(transaction2);
-        doNothing().when(transaction2).merge(any(LogicalDatastoreType.class),
-                any(InstanceIdentifier.class), any(EecProfiles.class));
-        when(transaction2.commit()).thenReturn(checkedFuture);
-        LegatoUtils.addToOperationalDB(eecProfiles, instanceIdentifier, dataBroker);
-        verify(transaction2).merge(any(LogicalDatastoreType.class), any(InstanceIdentifier.class),
-                any(EecProfiles.class));
-        verify(transaction2).commit();
-    }
-
-
-    @SuppressWarnings("unchecked")
-    @Test
-    public void testEecProfileDeleteFromOperationalDB() {
-
-        final InstanceIdentifier<Profile> profileID =
-                InstanceIdentifier.create(MefGlobal.class).child(EecProfiles.class)
-                        .child(Profile.class, new ProfileKey(new Identifier1024(Constants.ONE)));
-
-        when(dataBroker.newWriteOnlyTransaction()).thenReturn(transaction);
-        doNothing().when(transaction).delete(any(LogicalDatastoreType.class),
-                any(InstanceIdentifier.class));
-        when(transaction.commit()).thenReturn(checkedFuture);
-        assertEquals(true, LegatoUtils.deleteFromOperationalDB(profileID, dataBroker));
-        verify(transaction).delete(any(LogicalDatastoreType.class), any(InstanceIdentifier.class));
-        verify(transaction).commit();
-    }
-
-}
diff --git a/legato-api/src/test/java/org/opendaylight/unimgr/mef/legato/global/l2cp/LegatoL2cpEecProfileDataTreeChangeListenerTest.java b/legato-api/src/test/java/org/opendaylight/unimgr/mef/legato/global/l2cp/LegatoL2cpEecProfileDataTreeChangeListenerTest.java
deleted file mode 100644 (file)
index 8d468e7..0000000
+++ /dev/null
@@ -1,175 +0,0 @@
-/*
- * Copyright (c) 2018 Xoriant Corporation and others. All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-
-package org.opendaylight.unimgr.mef.legato.global.l2cp;
-import static org.mockito.ArgumentMatchers.any;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.times;
-import static org.mockito.Mockito.verify;
-
-import java.util.ArrayList;
-import java.util.Collection;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.mockito.Mockito;
-import org.opendaylight.mdsal.binding.api.DataObjectModification;
-import org.opendaylight.mdsal.binding.api.DataObjectModification.ModificationType;
-import org.opendaylight.mdsal.binding.api.DataTreeIdentifier;
-import org.opendaylight.mdsal.binding.api.DataTreeModification;
-import org.opendaylight.unimgr.mef.legato.LegatoL2cpEecController;
-import org.opendaylight.yang.gen.v1.urn.mef.yang.mef.global.rev171215.mef.global.l2cp.eec.profiles.Profile;
-import org.opendaylight.yangtools.yang.binding.Augmentation;
-import org.opendaylight.yangtools.yang.binding.ChildOf;
-import org.opendaylight.yangtools.yang.binding.ChoiceIn;
-import org.opendaylight.yangtools.yang.binding.DataObject;
-import org.opendaylight.yangtools.yang.binding.Identifiable;
-import org.opendaylight.yangtools.yang.binding.Identifier;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier.PathArgument;
-import org.powermock.modules.junit4.PowerMockRunner;
-
-
-/**
- * @author Arif.Hussain@Xoriant.Com
- *
- */
-@RunWith(PowerMockRunner.class)
-public class LegatoL2cpEecProfileDataTreeChangeListenerTest {
-
-    private LegatoL2cpEecController legatoL2cpEecController;
-
-    @Before
-    public void setUp() throws Exception {
-        legatoL2cpEecController = mock(LegatoL2cpEecController.class, Mockito.CALLS_REAL_METHODS);
-    }
-
-    @SuppressWarnings("unchecked")
-    @Test
-    public void testL2cpEecDataTreeChangeListener() {
-        Collection<DataTreeModification<Profile>> collection = new ArrayList<DataTreeModification<Profile>>();
-        DataTreeModification<Profile> profile = getDataTree(ModificationType.WRITE);
-        collection.add(profile);
-        profile = getDataTree(ModificationType.DELETE);
-        collection.add(profile);
-        profile = getDataTree(ModificationType.SUBTREE_MODIFIED);
-        collection.add(profile);
-        legatoL2cpEecController.onDataTreeChanged(collection);
-        verify(legatoL2cpEecController, times(1)).add(any(DataTreeModification.class));
-        verify(legatoL2cpEecController, times(1)).remove(any(DataTreeModification.class));
-        verify(legatoL2cpEecController, times(1)).update(any(DataTreeModification.class));
-    }
-
-
-    private DataTreeModification<Profile> getDataTree(final ModificationType modificationType) {
-        final DataObjectModification<Profile> proDataObjModification = new DataObjectModification<Profile>() {
-            @Override
-            public Collection<DataObjectModification<? extends DataObject>> getModifiedChildren() {
-                // TODO Auto-generated method stub
-                return null;
-            }
-
-            @Override
-            public <C extends Identifiable<K> & ChildOf<? super Profile>, K extends Identifier<C>> DataObjectModification<C> getModifiedChildListItem(
-                    Class<C> arg0, K arg1) {
-                // TODO Auto-generated method stub
-                return null;
-            }
-
-            @Override
-            public <C extends ChildOf<? super Profile>> DataObjectModification<C> getModifiedChildContainer(Class<C> arg0) {
-                // TODO Auto-generated method stub
-                return null;
-            }
-
-            @Override
-            public DataObjectModification<? extends DataObject> getModifiedChild(PathArgument arg0) {
-                // TODO Auto-generated method stub
-                return null;
-            }
-
-            @Override
-            public <C extends Augmentation<Profile> & DataObject> DataObjectModification<C> getModifiedAugmentation(
-                    Class<C> arg0) {
-                // TODO Auto-generated method stub
-                return null;
-            }
-
-            @Override
-            public ModificationType getModificationType() {
-                return modificationType;
-            }
-
-            @Override
-            public PathArgument getIdentifier() {
-                // TODO Auto-generated method stub
-                return null;
-            }
-
-            @Override
-            public Class<Profile> getDataType() {
-                // TODO Auto-generated method stub
-                return null;
-            }
-
-            @Override
-            public Profile getDataBefore() {
-                // TODO Auto-generated method stub
-                return null;
-            }
-
-            @Override
-            public Profile getDataAfter() {
-                // TODO Auto-generated method stub
-                return null;
-            }
-
-            @Override
-            public <C extends ChildOf<? super Profile>> Collection<DataObjectModification<C>> getModifiedChildren(
-                    Class<C> childType) {
-                // TODO Auto-generated method stub
-                return null;
-            }
-
-            @Override
-            public <H extends ChoiceIn<? super Profile> & DataObject, C extends ChildOf<? super H>> Collection<DataObjectModification<C>> getModifiedChildren(
-                    Class<H> caseType, Class<C> childType) {
-                // TODO Auto-generated method stub
-                return null;
-            }
-
-            @Override
-            public <H extends ChoiceIn<? super Profile> & DataObject, C extends ChildOf<? super H>> DataObjectModification<C> getModifiedChildContainer(
-                    Class<H> caseType, Class<C> child) {
-                // TODO Auto-generated method stub
-                return null;
-            }
-
-            @Override
-            public <H extends ChoiceIn<? super Profile> & DataObject, C extends Identifiable<K> & ChildOf<? super H>, K extends Identifier<C>> DataObjectModification<C> getModifiedChildListItem(
-                    Class<H> caseType, Class<C> listItem, K listKey) {
-                // TODO Auto-generated method stub
-                return null;
-            }
-        };
-
-        DataTreeModification<Profile> modifiedPro = new DataTreeModification<Profile>() {
-            @Override
-            public DataTreeIdentifier<Profile> getRootPath() {
-                return null;
-            }
-
-            @Override
-            public DataObjectModification<Profile> getRootNode() {
-                return proDataObjModification;
-            }
-        };
-        return modifiedPro;
-    }
-
-}
diff --git a/legato-api/src/test/java/org/opendaylight/unimgr/mef/legato/global/l2cp/LegatoL2cpEecProfileUnitTest.java b/legato-api/src/test/java/org/opendaylight/unimgr/mef/legato/global/l2cp/LegatoL2cpEecProfileUnitTest.java
deleted file mode 100644 (file)
index 2d3aad0..0000000
+++ /dev/null
@@ -1,147 +0,0 @@
-/*
- * Copyright (c) 2018 Xoriant Corporation and others. All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.unimgr.mef.legato.global.l2cp;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.mockito.ArgumentMatchers.any;
-import static org.mockito.Mockito.doNothing;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.when;
-
-import java.util.Optional;
-import java.util.concurrent.ExecutionException;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.mockito.Mock;
-import org.mockito.Mockito;
-import org.opendaylight.mdsal.binding.api.DataBroker;
-import org.opendaylight.mdsal.binding.api.ReadTransaction;
-import org.opendaylight.mdsal.binding.api.WriteTransaction;
-import org.opendaylight.mdsal.common.api.LogicalDatastoreType;
-import org.opendaylight.unimgr.mef.legato.LegatoL2cpEecController;
-import org.opendaylight.unimgr.mef.legato.util.LegatoConstants;
-import org.opendaylight.unimgr.mef.legato.util.LegatoUtils;
-import org.opendaylight.unimgr.mef.legato.utils.Constants;
-import org.opendaylight.yang.gen.v1.urn.mef.yang.mef.global.rev171215.MefGlobal;
-import org.opendaylight.yang.gen.v1.urn.mef.yang.mef.global.rev171215.mef.global.L2cpEecProfiles;
-import org.opendaylight.yang.gen.v1.urn.mef.yang.mef.global.rev171215.mef.global.l2cp.eec.profiles.Profile;
-import org.opendaylight.yang.gen.v1.urn.mef.yang.mef.global.rev171215.mef.global.l2cp.eec.profiles.ProfileKey;
-import org.opendaylight.yang.gen.v1.urn.mef.yang.mef.types.rev171215.Identifier1024;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import org.powermock.api.mockito.PowerMockito;
-import org.powermock.core.classloader.annotations.PrepareForTest;
-import org.powermock.modules.junit4.PowerMockRunner;
-
-import com.google.common.util.concurrent.FluentFuture;
-
-
-@RunWith(PowerMockRunner.class)
-@PrepareForTest(Optional.class)
-public class LegatoL2cpEecProfileUnitTest {
-
-    @Mock
-    private DataBroker dataBroker;
-    @Mock
-    private WriteTransaction transaction;
-    @SuppressWarnings("rawtypes")
-    @Mock
-    private FluentFuture checkedFuture;
-
-    @Before
-    public void setUp() throws Exception {
-        mock(LegatoL2cpEecController.class, Mockito.CALLS_REAL_METHODS);
-    }
-
-
-    @SuppressWarnings("unchecked")
-    @Test
-    public void testL2cpEecAddToOperationalDB() {
-        final L2cpEecProfiles l2cpEecProfiles = mock(L2cpEecProfiles.class);
-        final InstanceIdentifier<L2cpEecProfiles> instanceIdentifier =
-                InstanceIdentifier.builder(MefGlobal.class).child(L2cpEecProfiles.class).build();
-
-        when(dataBroker.newWriteOnlyTransaction()).thenReturn(transaction);
-        doNothing().when(transaction).merge(any(LogicalDatastoreType.class),
-                any(InstanceIdentifier.class), any(L2cpEecProfiles.class));
-        when(transaction.commit()).thenReturn(checkedFuture);
-        LegatoUtils.addToOperationalDB(l2cpEecProfiles, instanceIdentifier, dataBroker);
-        verify(transaction).merge(any(LogicalDatastoreType.class), any(InstanceIdentifier.class),
-                any(L2cpEecProfiles.class));
-        verify(transaction).commit();
-    }
-
-    @SuppressWarnings("unchecked")
-    @Test
-    public void testL2cpEecUpdateFromOperationalDB() throws InterruptedException, ExecutionException {
-        final InstanceIdentifier<Profile> profileID =
-                InstanceIdentifier.create(MefGlobal.class).child(L2cpEecProfiles.class)
-                        .child(Profile.class, new ProfileKey(new Identifier1024(Constants.ONE)));
-
-        ReadTransaction readTransaction = mock(ReadTransaction.class);
-        when(dataBroker.newReadOnlyTransaction()).thenReturn(readTransaction);
-        FluentFuture<Optional<Profile>> proFuture = mock(FluentFuture.class);
-
-        Optional<Profile> optProfile = PowerMockito.mock(Optional.class);
-        when(readTransaction.read(any(LogicalDatastoreType.class), any(InstanceIdentifier.class)))
-                .thenReturn(proFuture);
-        when(proFuture.get()).thenReturn(optProfile);
-
-        Optional<Profile> expectedOpt =
-                (Optional<Profile>) LegatoUtils.readProfile(LegatoConstants.L2CP_EEC_PROFILES,
-                        dataBroker, LogicalDatastoreType.CONFIGURATION, profileID);
-        verify(readTransaction).read(any(LogicalDatastoreType.class),
-                any(InstanceIdentifier.class));
-        assertNotNull(expectedOpt);
-        assertEquals(expectedOpt, optProfile);
-
-        when(dataBroker.newWriteOnlyTransaction()).thenReturn(transaction);
-        doNothing().when(transaction).delete(any(LogicalDatastoreType.class),
-                any(InstanceIdentifier.class));
-        when(transaction.commit()).thenReturn(checkedFuture);
-        assertEquals(true, LegatoUtils.deleteFromOperationalDB(profileID, dataBroker));
-        verify(transaction).delete(any(LogicalDatastoreType.class), any(InstanceIdentifier.class));
-        verify(transaction).commit();
-
-        final L2cpEecProfiles l2cpEecProfiles = mock(L2cpEecProfiles.class);
-        final InstanceIdentifier<L2cpEecProfiles> instanceIdentifier =
-                InstanceIdentifier.builder(MefGlobal.class).child(L2cpEecProfiles.class).build();
-
-        WriteTransaction transaction2 = Mockito.mock(WriteTransaction.class);
-        when(dataBroker.newWriteOnlyTransaction()).thenReturn(transaction2);
-        doNothing().when(transaction2).merge(any(LogicalDatastoreType.class),
-                any(InstanceIdentifier.class), any(L2cpEecProfiles.class));
-        when(transaction2.commit()).thenReturn(checkedFuture);
-        LegatoUtils.addToOperationalDB(l2cpEecProfiles, instanceIdentifier, dataBroker);
-        verify(transaction2).merge(any(LogicalDatastoreType.class), any(InstanceIdentifier.class),
-                any(L2cpEecProfiles.class));
-        verify(transaction2).commit();
-    }
-
-
-    @SuppressWarnings("unchecked")
-    @Test
-    public void testL2cpEecDeleteFromOperationalDB() {
-        final InstanceIdentifier<Profile> profileID =
-                InstanceIdentifier.create(MefGlobal.class).child(L2cpEecProfiles.class)
-                        .child(Profile.class, new ProfileKey(new Identifier1024(Constants.ONE)));
-
-        when(dataBroker.newWriteOnlyTransaction()).thenReturn(transaction);
-        doNothing().when(transaction).delete(any(LogicalDatastoreType.class),
-                any(InstanceIdentifier.class));
-        when(transaction.commit()).thenReturn(checkedFuture);
-        assertEquals(true, LegatoUtils.deleteFromOperationalDB(profileID, dataBroker));
-        verify(transaction).delete(any(LogicalDatastoreType.class), any(InstanceIdentifier.class));
-        verify(transaction).commit();
-
-    }
-
-}
diff --git a/legato-api/src/test/java/org/opendaylight/unimgr/mef/legato/global/l2cp/LegatoL2cpPeeringProfileDataTreeChangeListenerTest.java b/legato-api/src/test/java/org/opendaylight/unimgr/mef/legato/global/l2cp/LegatoL2cpPeeringProfileDataTreeChangeListenerTest.java
deleted file mode 100644 (file)
index d53260d..0000000
+++ /dev/null
@@ -1,175 +0,0 @@
-/*
- * Copyright (c) 2018 Xoriant Corporation and others. All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-
-package org.opendaylight.unimgr.mef.legato.global.l2cp;
-import static org.mockito.ArgumentMatchers.any;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.times;
-import static org.mockito.Mockito.verify;
-
-import java.util.ArrayList;
-import java.util.Collection;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.mockito.Mockito;
-import org.opendaylight.mdsal.binding.api.DataObjectModification;
-import org.opendaylight.mdsal.binding.api.DataObjectModification.ModificationType;
-import org.opendaylight.mdsal.binding.api.DataTreeIdentifier;
-import org.opendaylight.mdsal.binding.api.DataTreeModification;
-import org.opendaylight.unimgr.mef.legato.LegatoL2cpPeeringController;
-import org.opendaylight.yang.gen.v1.urn.mef.yang.mef.global.rev171215.mef.global.l2cp.peering.profiles.Profile;
-import org.opendaylight.yangtools.yang.binding.Augmentation;
-import org.opendaylight.yangtools.yang.binding.ChildOf;
-import org.opendaylight.yangtools.yang.binding.ChoiceIn;
-import org.opendaylight.yangtools.yang.binding.DataObject;
-import org.opendaylight.yangtools.yang.binding.Identifiable;
-import org.opendaylight.yangtools.yang.binding.Identifier;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier.PathArgument;
-import org.powermock.modules.junit4.PowerMockRunner;
-
-
-/**
- * @author Arif.Hussain@Xoriant.Com
- *
- */
-@RunWith(PowerMockRunner.class)
-public class LegatoL2cpPeeringProfileDataTreeChangeListenerTest {
-
-    private LegatoL2cpPeeringController legatoL2cpPeeringController;
-
-    @Before
-    public void setUp() throws Exception {
-        legatoL2cpPeeringController = mock(LegatoL2cpPeeringController.class, Mockito.CALLS_REAL_METHODS);
-    }
-
-    @SuppressWarnings("unchecked")
-    @Test
-    public void testL2cpPeeringDataTreeChangeListener() {
-        Collection<DataTreeModification<Profile>> collection = new ArrayList<DataTreeModification<Profile>>();
-        DataTreeModification<Profile> profile = getDataTree(ModificationType.WRITE);
-        collection.add(profile);
-        profile = getDataTree(ModificationType.DELETE);
-        collection.add(profile);
-        profile = getDataTree(ModificationType.SUBTREE_MODIFIED);
-        collection.add(profile);
-        legatoL2cpPeeringController.onDataTreeChanged(collection);
-        verify(legatoL2cpPeeringController, times(1)).add(any(DataTreeModification.class));
-        verify(legatoL2cpPeeringController, times(1)).remove(any(DataTreeModification.class));
-        verify(legatoL2cpPeeringController, times(1)).update(any(DataTreeModification.class));
-    }
-
-
-    private DataTreeModification<Profile> getDataTree(final ModificationType modificationType) {
-        final DataObjectModification<Profile> proDataObjModification = new DataObjectModification<Profile>() {
-            @Override
-            public Collection<DataObjectModification<? extends DataObject>> getModifiedChildren() {
-                // TODO Auto-generated method stub
-                return null;
-            }
-
-            @Override
-            public <C extends Identifiable<K> & ChildOf<? super Profile>, K extends Identifier<C>> DataObjectModification<C> getModifiedChildListItem(
-                    Class<C> arg0, K arg1) {
-                // TODO Auto-generated method stub
-                return null;
-            }
-
-            @Override
-            public <C extends ChildOf<? super Profile>> DataObjectModification<C> getModifiedChildContainer(Class<C> arg0) {
-                // TODO Auto-generated method stub
-                return null;
-            }
-
-            @Override
-            public DataObjectModification<? extends DataObject> getModifiedChild(PathArgument arg0) {
-                // TODO Auto-generated method stub
-                return null;
-            }
-
-            @Override
-            public <C extends Augmentation<Profile> & DataObject> DataObjectModification<C> getModifiedAugmentation(
-                    Class<C> arg0) {
-                // TODO Auto-generated method stub
-                return null;
-            }
-
-            @Override
-            public ModificationType getModificationType() {
-                return modificationType;
-            }
-
-            @Override
-            public PathArgument getIdentifier() {
-                // TODO Auto-generated method stub
-                return null;
-            }
-
-            @Override
-            public Class<Profile> getDataType() {
-                // TODO Auto-generated method stub
-                return null;
-            }
-
-            @Override
-            public Profile getDataBefore() {
-                // TODO Auto-generated method stub
-                return null;
-            }
-
-            @Override
-            public Profile getDataAfter() {
-                // TODO Auto-generated method stub
-                return null;
-            }
-
-            @Override
-            public <C extends ChildOf<? super Profile>> Collection<DataObjectModification<C>> getModifiedChildren(
-                    Class<C> childType) {
-                // TODO Auto-generated method stub
-                return null;
-            }
-
-            @Override
-            public <H extends ChoiceIn<? super Profile> & DataObject, C extends ChildOf<? super H>> Collection<DataObjectModification<C>> getModifiedChildren(
-                    Class<H> caseType, Class<C> childType) {
-                // TODO Auto-generated method stub
-                return null;
-            }
-
-            @Override
-            public <H extends ChoiceIn<? super Profile> & DataObject, C extends ChildOf<? super H>> DataObjectModification<C> getModifiedChildContainer(
-                    Class<H> caseType, Class<C> child) {
-                // TODO Auto-generated method stub
-                return null;
-            }
-
-            @Override
-            public <H extends ChoiceIn<? super Profile> & DataObject, C extends Identifiable<K> & ChildOf<? super H>, K extends Identifier<C>> DataObjectModification<C> getModifiedChildListItem(
-                    Class<H> caseType, Class<C> listItem, K listKey) {
-                // TODO Auto-generated method stub
-                return null;
-            }
-        };
-
-        DataTreeModification<Profile> modifiedPro = new DataTreeModification<Profile>() {
-            @Override
-            public DataTreeIdentifier<Profile> getRootPath() {
-                return null;
-            }
-
-            @Override
-            public DataObjectModification<Profile> getRootNode() {
-                return proDataObjModification;
-            }
-        };
-        return modifiedPro;
-    }
-
-}
diff --git a/legato-api/src/test/java/org/opendaylight/unimgr/mef/legato/global/l2cp/LegatoL2cpPeeringProfileUnitTest.java b/legato-api/src/test/java/org/opendaylight/unimgr/mef/legato/global/l2cp/LegatoL2cpPeeringProfileUnitTest.java
deleted file mode 100644 (file)
index 22168c8..0000000
+++ /dev/null
@@ -1,147 +0,0 @@
-/*
- * Copyright (c) 2018 Xoriant Corporation and others. All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.unimgr.mef.legato.global.l2cp;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.mockito.ArgumentMatchers.any;
-import static org.mockito.Mockito.doNothing;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.when;
-
-import java.util.Optional;
-import java.util.concurrent.ExecutionException;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.mockito.Mock;
-import org.mockito.Mockito;
-import org.opendaylight.mdsal.binding.api.DataBroker;
-import org.opendaylight.mdsal.binding.api.ReadTransaction;
-import org.opendaylight.mdsal.binding.api.WriteTransaction;
-import org.opendaylight.mdsal.common.api.LogicalDatastoreType;
-import org.opendaylight.unimgr.mef.legato.LegatoL2cpPeeringController;
-import org.opendaylight.unimgr.mef.legato.util.LegatoConstants;
-import org.opendaylight.unimgr.mef.legato.util.LegatoUtils;
-import org.opendaylight.unimgr.mef.legato.utils.Constants;
-import org.opendaylight.yang.gen.v1.urn.mef.yang.mef.global.rev171215.MefGlobal;
-import org.opendaylight.yang.gen.v1.urn.mef.yang.mef.global.rev171215.mef.global.L2cpPeeringProfiles;
-import org.opendaylight.yang.gen.v1.urn.mef.yang.mef.global.rev171215.mef.global.l2cp.peering.profiles.Profile;
-import org.opendaylight.yang.gen.v1.urn.mef.yang.mef.global.rev171215.mef.global.l2cp.peering.profiles.ProfileKey;
-import org.opendaylight.yang.gen.v1.urn.mef.yang.mef.types.rev171215.Identifier1024;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import org.powermock.api.mockito.PowerMockito;
-import org.powermock.core.classloader.annotations.PrepareForTest;
-import org.powermock.modules.junit4.PowerMockRunner;
-
-import com.google.common.util.concurrent.FluentFuture;
-
-
-@RunWith(PowerMockRunner.class)
-@PrepareForTest(Optional.class)
-public class LegatoL2cpPeeringProfileUnitTest {
-
-    @Mock
-    private DataBroker dataBroker;
-    @Mock
-    private WriteTransaction transaction;
-    @SuppressWarnings("rawtypes")
-    @Mock
-    private FluentFuture checkedFuture;
-
-    @Before
-    public void setUp() throws Exception {
-        mock(LegatoL2cpPeeringController.class, Mockito.CALLS_REAL_METHODS);
-    }
-
-    @SuppressWarnings("unchecked")
-    @Test
-    public void testL2cpPeeringAddToOperationalDB() {
-        final L2cpPeeringProfiles l2cpPeeringProfiles = mock(L2cpPeeringProfiles.class);
-        final InstanceIdentifier<L2cpPeeringProfiles> instanceIdentifier = InstanceIdentifier
-                .builder(MefGlobal.class).child(L2cpPeeringProfiles.class).build();
-
-        when(dataBroker.newWriteOnlyTransaction()).thenReturn(transaction);
-        doNothing().when(transaction).merge(any(LogicalDatastoreType.class),
-                any(InstanceIdentifier.class), any(L2cpPeeringProfiles.class));
-        when(transaction.commit()).thenReturn(checkedFuture);
-        LegatoUtils.addToOperationalDB(l2cpPeeringProfiles, instanceIdentifier, dataBroker);
-        verify(transaction).merge(any(LogicalDatastoreType.class), any(InstanceIdentifier.class),
-                any(L2cpPeeringProfiles.class));
-        verify(transaction).commit();
-    }
-
-
-    @SuppressWarnings("unchecked")
-    @Test
-    public void testL2cpPeeringUpdateFromOperationalDB() throws InterruptedException, ExecutionException {
-        final InstanceIdentifier<Profile> profileID =
-                InstanceIdentifier.create(MefGlobal.class).child(L2cpPeeringProfiles.class)
-                        .child(Profile.class, new ProfileKey(new Identifier1024(Constants.ONE)));
-
-        ReadTransaction readTransaction = mock(ReadTransaction.class);
-        when(dataBroker.newReadOnlyTransaction()).thenReturn(readTransaction);
-        FluentFuture<Optional<Profile>> proFuture = mock(FluentFuture.class);
-
-        Optional<Profile> optProfile = PowerMockito.mock(Optional.class);
-        when(readTransaction.read(any(LogicalDatastoreType.class), any(InstanceIdentifier.class)))
-                .thenReturn(proFuture);
-        when(proFuture.get()).thenReturn(optProfile);
-
-        Optional<Profile> expectedOpt =
-                (Optional<Profile>) LegatoUtils.readProfile(LegatoConstants.L2CP_PEERING_PROFILES,
-                        dataBroker, LogicalDatastoreType.CONFIGURATION, profileID);
-        verify(readTransaction).read(any(LogicalDatastoreType.class),
-                any(InstanceIdentifier.class));
-        assertNotNull(expectedOpt);
-        assertEquals(expectedOpt, optProfile);
-
-        when(dataBroker.newWriteOnlyTransaction()).thenReturn(transaction);
-        doNothing().when(transaction).delete(any(LogicalDatastoreType.class),
-                any(InstanceIdentifier.class));
-        when(transaction.commit()).thenReturn(checkedFuture);
-        assertEquals(true, LegatoUtils.deleteFromOperationalDB(profileID, dataBroker));
-        verify(transaction).delete(any(LogicalDatastoreType.class), any(InstanceIdentifier.class));
-        verify(transaction).commit();
-
-        final L2cpPeeringProfiles l2cpPeeringProfiles = mock(L2cpPeeringProfiles.class);
-        final InstanceIdentifier<L2cpPeeringProfiles> instanceIdentifier = InstanceIdentifier
-                .builder(MefGlobal.class).child(L2cpPeeringProfiles.class).build();
-
-        WriteTransaction transaction2 = Mockito.mock(WriteTransaction.class);
-        when(dataBroker.newWriteOnlyTransaction()).thenReturn(transaction2);
-        doNothing().when(transaction2).merge(any(LogicalDatastoreType.class),
-                any(InstanceIdentifier.class), any(L2cpPeeringProfiles.class));
-        when(transaction2.commit()).thenReturn(checkedFuture);
-        LegatoUtils.addToOperationalDB(l2cpPeeringProfiles, instanceIdentifier, dataBroker);
-        verify(transaction2).merge(any(LogicalDatastoreType.class), any(InstanceIdentifier.class),
-                any(L2cpPeeringProfiles.class));
-        verify(transaction2).commit();
-    }
-
-
-
-    @SuppressWarnings("unchecked")
-    @Test
-    public void testL2cpPeeringDeleteFromOperationalDB() {
-
-        final InstanceIdentifier<Profile> profileID =
-                InstanceIdentifier.create(MefGlobal.class).child(L2cpPeeringProfiles.class)
-                        .child(Profile.class, new ProfileKey(new Identifier1024(Constants.ONE)));
-
-        when(dataBroker.newWriteOnlyTransaction()).thenReturn(transaction);
-        doNothing().when(transaction).delete(any(LogicalDatastoreType.class),
-                any(InstanceIdentifier.class));
-        when(transaction.commit()).thenReturn(checkedFuture);
-        assertEquals(true, LegatoUtils.deleteFromOperationalDB(profileID, dataBroker));
-        verify(transaction).delete(any(LogicalDatastoreType.class), any(InstanceIdentifier.class));
-        verify(transaction).commit();
-    }
-}
diff --git a/legato-api/src/test/java/org/opendaylight/unimgr/mef/legato/global/sls/LegatoSlsProfileDataTreeChangeListenerTest.java b/legato-api/src/test/java/org/opendaylight/unimgr/mef/legato/global/sls/LegatoSlsProfileDataTreeChangeListenerTest.java
deleted file mode 100644 (file)
index 066a075..0000000
+++ /dev/null
@@ -1,174 +0,0 @@
-/*
- * Copyright (c) 2018 Xoriant Corporation and others. All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-
-package org.opendaylight.unimgr.mef.legato.global.sls;
-import static org.mockito.ArgumentMatchers.any;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.times;
-import static org.mockito.Mockito.verify;
-
-import java.util.ArrayList;
-import java.util.Collection;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.mockito.Mockito;
-import org.opendaylight.mdsal.binding.api.DataObjectModification;
-import org.opendaylight.mdsal.binding.api.DataObjectModification.ModificationType;
-import org.opendaylight.mdsal.binding.api.DataTreeIdentifier;
-import org.opendaylight.mdsal.binding.api.DataTreeModification;
-import org.opendaylight.unimgr.mef.legato.LegatoSlsProfileController;
-import org.opendaylight.yang.gen.v1.urn.mef.yang.mef.global.rev171215.mef.global.sls.profiles.Profile;
-import org.opendaylight.yangtools.yang.binding.Augmentation;
-import org.opendaylight.yangtools.yang.binding.ChildOf;
-import org.opendaylight.yangtools.yang.binding.ChoiceIn;
-import org.opendaylight.yangtools.yang.binding.DataObject;
-import org.opendaylight.yangtools.yang.binding.Identifiable;
-import org.opendaylight.yangtools.yang.binding.Identifier;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier.PathArgument;
-import org.powermock.modules.junit4.PowerMockRunner;
-
-/**
- * @author Arif.Hussain@Xoriant.Com
- *
- */
-@RunWith(PowerMockRunner.class)
-public class LegatoSlsProfileDataTreeChangeListenerTest {
-
-    private LegatoSlsProfileController legatoSlsProfileController;
-
-    @Before
-    public void setUp() throws Exception {
-        legatoSlsProfileController = mock(LegatoSlsProfileController.class, Mockito.CALLS_REAL_METHODS);
-    }
-
-    @SuppressWarnings("unchecked")
-    @Test
-    public void testL2cpEecDataTreeChangeListener() {
-        Collection<DataTreeModification<Profile>> collection = new ArrayList<DataTreeModification<Profile>>();
-        DataTreeModification<Profile> profile = getDataTree(ModificationType.WRITE);
-        collection.add(profile);
-        profile = getDataTree(ModificationType.DELETE);
-        collection.add(profile);
-        profile = getDataTree(ModificationType.SUBTREE_MODIFIED);
-        collection.add(profile);
-        legatoSlsProfileController.onDataTreeChanged(collection);
-        verify(legatoSlsProfileController, times(1)).add(any(DataTreeModification.class));
-        verify(legatoSlsProfileController, times(1)).remove(any(DataTreeModification.class));
-        verify(legatoSlsProfileController, times(1)).update(any(DataTreeModification.class));
-    }
-
-    private DataTreeModification<Profile> getDataTree(final ModificationType modificationType) {
-        final DataObjectModification<Profile> proDataObjModification = new DataObjectModification<Profile>() {
-            @Override
-            public Collection<DataObjectModification<? extends DataObject>> getModifiedChildren() {
-                // TODO Auto-generated method stub
-                return null;
-            }
-
-            @Override
-            public <C extends Identifiable<K> & ChildOf<? super Profile>, K extends Identifier<C>> DataObjectModification<C> getModifiedChildListItem(
-                    Class<C> arg0, K arg1) {
-                // TODO Auto-generated method stub
-                return null;
-            }
-
-            @Override
-            public <C extends ChildOf<? super Profile>> DataObjectModification<C> getModifiedChildContainer(Class<C> arg0) {
-                // TODO Auto-generated method stub
-                return null;
-            }
-
-            @Override
-            public DataObjectModification<? extends DataObject> getModifiedChild(PathArgument arg0) {
-                // TODO Auto-generated method stub
-                return null;
-            }
-
-            @Override
-            public <C extends Augmentation<Profile> & DataObject> DataObjectModification<C> getModifiedAugmentation(
-                    Class<C> arg0) {
-                // TODO Auto-generated method stub
-                return null;
-            }
-
-            @Override
-            public ModificationType getModificationType() {
-                return modificationType;
-            }
-
-            @Override
-            public PathArgument getIdentifier() {
-                // TODO Auto-generated method stub
-                return null;
-            }
-
-            @Override
-            public Class<Profile> getDataType() {
-                // TODO Auto-generated method stub
-                return null;
-            }
-
-            @Override
-            public Profile getDataBefore() {
-                // TODO Auto-generated method stub
-                return null;
-            }
-
-            @Override
-            public Profile getDataAfter() {
-                // TODO Auto-generated method stub
-                return null;
-            }
-
-            @Override
-            public <C extends ChildOf<? super Profile>> Collection<DataObjectModification<C>> getModifiedChildren(
-                    Class<C> childType) {
-                // TODO Auto-generated method stub
-                return null;
-            }
-
-            @Override
-            public <H extends ChoiceIn<? super Profile> & DataObject, C extends ChildOf<? super H>> Collection<DataObjectModification<C>> getModifiedChildren(
-                    Class<H> caseType, Class<C> childType) {
-                // TODO Auto-generated method stub
-                return null;
-            }
-
-            @Override
-            public <H extends ChoiceIn<? super Profile> & DataObject, C extends ChildOf<? super H>> DataObjectModification<C> getModifiedChildContainer(
-                    Class<H> caseType, Class<C> child) {
-                // TODO Auto-generated method stub
-                return null;
-            }
-
-            @Override
-            public <H extends ChoiceIn<? super Profile> & DataObject, C extends Identifiable<K> & ChildOf<? super H>, K extends Identifier<C>> DataObjectModification<C> getModifiedChildListItem(
-                    Class<H> caseType, Class<C> listItem, K listKey) {
-                // TODO Auto-generated method stub
-                return null;
-            }
-        };
-
-        DataTreeModification<Profile> modifiedPro = new DataTreeModification<Profile>() {
-            @Override
-            public DataTreeIdentifier<Profile> getRootPath() {
-                return null;
-            }
-
-            @Override
-            public DataObjectModification<Profile> getRootNode() {
-                return proDataObjModification;
-            }
-        };
-
-        return modifiedPro;
-    }
-
-}
diff --git a/legato-api/src/test/java/org/opendaylight/unimgr/mef/legato/global/sls/LegatoSlsProfileUnitTest.java b/legato-api/src/test/java/org/opendaylight/unimgr/mef/legato/global/sls/LegatoSlsProfileUnitTest.java
deleted file mode 100644 (file)
index 736fe0e..0000000
+++ /dev/null
@@ -1,146 +0,0 @@
-/*
- * Copyright (c) 2018 Xoriant Corporation and others. All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.unimgr.mef.legato.global.sls;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.mockito.ArgumentMatchers.any;
-import static org.mockito.Mockito.doNothing;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.when;
-
-import java.util.Optional;
-import java.util.concurrent.ExecutionException;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.mockito.Mock;
-import org.mockito.Mockito;
-import org.opendaylight.mdsal.binding.api.DataBroker;
-import org.opendaylight.mdsal.binding.api.ReadTransaction;
-import org.opendaylight.mdsal.binding.api.WriteTransaction;
-import org.opendaylight.mdsal.common.api.LogicalDatastoreType;
-import org.opendaylight.unimgr.mef.legato.LegatoSlsProfileController;
-import org.opendaylight.unimgr.mef.legato.util.LegatoConstants;
-import org.opendaylight.unimgr.mef.legato.util.LegatoUtils;
-import org.opendaylight.unimgr.mef.legato.utils.Constants;
-import org.opendaylight.yang.gen.v1.urn.mef.yang.mef.global.rev171215.MefGlobal;
-import org.opendaylight.yang.gen.v1.urn.mef.yang.mef.global.rev171215.mef.global.SlsProfiles;
-import org.opendaylight.yang.gen.v1.urn.mef.yang.mef.global.rev171215.mef.global.sls.profiles.Profile;
-import org.opendaylight.yang.gen.v1.urn.mef.yang.mef.global.rev171215.mef.global.sls.profiles.ProfileKey;
-import org.opendaylight.yang.gen.v1.urn.mef.yang.mef.types.rev171215.Identifier1024;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import org.powermock.api.mockito.PowerMockito;
-import org.powermock.core.classloader.annotations.PrepareForTest;
-import org.powermock.modules.junit4.PowerMockRunner;
-
-import com.google.common.util.concurrent.FluentFuture;
-
-
-@RunWith(PowerMockRunner.class)
-@PrepareForTest({Optional.class})
-public class LegatoSlsProfileUnitTest {
-
-    @Mock
-    private DataBroker dataBroker;
-    @Mock
-    private WriteTransaction transaction;
-    @SuppressWarnings("rawtypes")
-    @Mock
-    private FluentFuture checkedFuture;
-
-    @Before
-    public void setUp() throws Exception {
-        mock(LegatoSlsProfileController.class, Mockito.CALLS_REAL_METHODS);
-    }
-
-
-    @SuppressWarnings("unchecked")
-    @Test
-    public void testSlsProfileAddToOperationalDB() {
-        final SlsProfiles slsProfiles = mock(SlsProfiles.class);
-        final InstanceIdentifier<SlsProfiles> instanceIdentifier =
-                InstanceIdentifier.builder(MefGlobal.class).child(SlsProfiles.class).build();
-
-        when(dataBroker.newWriteOnlyTransaction()).thenReturn(transaction);
-        doNothing().when(transaction).merge(any(LogicalDatastoreType.class),
-                any(InstanceIdentifier.class), any(SlsProfiles.class));
-        when(transaction.commit()).thenReturn(checkedFuture);
-        LegatoUtils.addToOperationalDB(slsProfiles, instanceIdentifier, dataBroker);
-        verify(transaction).merge(any(LogicalDatastoreType.class), any(InstanceIdentifier.class),
-                any(SlsProfiles.class));
-        verify(transaction).commit();
-    }
-
-    @SuppressWarnings("unchecked")
-    @Test
-    public void testSlsProfileUpdateFromOperationalDB() throws InterruptedException, ExecutionException {
-        final InstanceIdentifier<Profile> profileID =
-                InstanceIdentifier.create(MefGlobal.class).child(SlsProfiles.class)
-                        .child(Profile.class, new ProfileKey(new Identifier1024(Constants.ONE)));
-
-        ReadTransaction readTransaction = mock(ReadTransaction.class);
-        when(dataBroker.newReadOnlyTransaction()).thenReturn(readTransaction);
-        FluentFuture<Optional<Profile>> proFuture = mock(FluentFuture.class);
-
-        Optional<Profile> optProfile = PowerMockito.mock(Optional.class);
-        when(readTransaction.read(any(LogicalDatastoreType.class), any(InstanceIdentifier.class)))
-                .thenReturn(proFuture);
-        when(proFuture.get()).thenReturn(optProfile);
-
-        Optional<Profile> expectedOpt =
-                (Optional<Profile>) LegatoUtils.readProfile(LegatoConstants.SLS_PROFILES,
-                        dataBroker, LogicalDatastoreType.CONFIGURATION, profileID);
-        verify(readTransaction).read(any(LogicalDatastoreType.class),
-                any(InstanceIdentifier.class));
-        assertNotNull(expectedOpt);
-        assertEquals(expectedOpt, optProfile);
-
-        when(dataBroker.newWriteOnlyTransaction()).thenReturn(transaction);
-        doNothing().when(transaction).delete(any(LogicalDatastoreType.class),
-                any(InstanceIdentifier.class));
-        when(transaction.commit()).thenReturn(checkedFuture);
-        assertEquals(true, LegatoUtils.deleteFromOperationalDB(profileID, dataBroker));
-        verify(transaction).delete(any(LogicalDatastoreType.class), any(InstanceIdentifier.class));
-        verify(transaction).commit();
-
-        final SlsProfiles slsProfiles = mock(SlsProfiles.class);
-        final InstanceIdentifier<SlsProfiles> instanceIdentifier =
-                InstanceIdentifier.builder(MefGlobal.class).child(SlsProfiles.class).build();
-
-        WriteTransaction transaction2 = Mockito.mock(WriteTransaction.class);
-        when(dataBroker.newWriteOnlyTransaction()).thenReturn(transaction2);
-        doNothing().when(transaction2).merge(any(LogicalDatastoreType.class),
-                any(InstanceIdentifier.class), any(SlsProfiles.class));
-        when(transaction2.commit()).thenReturn(checkedFuture);
-        LegatoUtils.addToOperationalDB(slsProfiles, instanceIdentifier, dataBroker);
-        verify(transaction2).merge(any(LogicalDatastoreType.class), any(InstanceIdentifier.class),
-                any(SlsProfiles.class));
-        verify(transaction2).commit();
-    }
-
-
-    @SuppressWarnings("unchecked")
-    @Test
-    public void testSlsProfileDeleteFromOperationalDB() {
-        final InstanceIdentifier<Profile> profileID =
-                InstanceIdentifier.create(MefGlobal.class).child(SlsProfiles.class)
-                        .child(Profile.class, new ProfileKey(new Identifier1024(Constants.ONE)));
-
-        when(dataBroker.newWriteOnlyTransaction()).thenReturn(transaction);
-        doNothing().when(transaction).delete(any(LogicalDatastoreType.class),
-                any(InstanceIdentifier.class));
-        when(transaction.commit()).thenReturn(checkedFuture);
-        assertEquals(true, LegatoUtils.deleteFromOperationalDB(profileID, dataBroker));
-        verify(transaction).delete(any(LogicalDatastoreType.class), any(InstanceIdentifier.class));
-        verify(transaction).commit();
-    }
-
-}
index 826469191a2b7d6ed3fbfe68856680606c6b7221..16fc7b0f62f54dc648ab279a2e80f9aea778e51d 100644 (file)
@@ -8,35 +8,68 @@
 
 package org.opendaylight.unimgr.mef.legato.utils;
 
-/**
+/*
  * @author Arif.Hussain@Xoriant.Com
- *
  */
-public class Constants {
+
+public final class Constants {
+
+    private Constants() {
+        throw new IllegalStateException(Constants.CONSTANTS);
+    }
 
     public static final String EVC_ID_TYPE = "EVC1";
+
     public static final String EVC_ID = "EVC_ID";
+
     public static final String EVC_UNI = "EVC_UNI_LIST";
+
     public static final String EVC_CON_TYPE = "POINTTOPOINT";
+
     public static final String SLS_PROFILES = "SLS_PROFILES";
+
     public static final String COSNAME = "EVPL";
+
     public static final String UNI_ID1 = "sip:ovs-node:s1:s1-eth1";
+
     public static final String UNI_ID2 = "sip:ovs-node:s2:s2-eth1";
+
+    public static final String UNI_ID3 = "sip:ovs-node:s3:s3-eth1";
+
     public static final String UUID = "cs:162052f6bb1:73aaf0f5";
+
     public static final String READ_EVC = "readEvc";
+
     public static final String PARSE_NODES = "parseNodes";
+
     public static final String DELETE_NODES_FROM_OPERATIONAL = "deleteFromOperationalDB";
+
     public static final String UPDATE_CONNECTIVITY_INPUT = "buildUpdateConnectivityServiceInput";
+
     public static final String CREATE_CONNECTIVITY_INPUT = "buildCreateConnectivityServiceInput";
+
     public static final String NRP_CARRIER_ETH_CON_RESOURCE = "buildNrpCarrierEthConnectivityResource";
+
     public static final String CREATE_ENDPOINTS = "buildCreateEndpoints";
+
     public static final String NRP_CARRIER_ETH_CON_ENDPOINT_RESOURCE = "buildNrpCarrierEthConnectivityEndPointResource";
+
     public static final String CREATE_ETH_CON_ENDPOINT_AUGMENTATION = "buildCreateEthConnectivityEndPointAugmentation";
+
     public static final String UPDATE_ETH_CON_ENDPOINT_AUGMENTATION = "buildUpdateEthConnectivityEndPointAugmentation";
+
     public static final String CREATE_CON_SERVICE_AUGMENTATION = "buildCreateConServiceAugmentation";
+
     public static final String UPDATE_CON_SERVICE_AUGMENTATION = "buildUpdateConServiceAugmentation";
+
     public static final int MAXFRAME_SIZE_TYPE = 1522;
-    public static final int VLAN_ID_TYPE = 301;
+
     public static final String ONE = "1";
+
     public static final String EPL = "epl";
+
+    public static final int VLAN_ID = 301;
+
+    public static final String CONSTANTS = "Constanats class";
+
 }
index 8f410c775072756b367e12f04d0af83bbe433a73..567a64e8dd4fa7cc25cab2c7fd4b99f4fd5479e5 100644 (file)
@@ -44,9 +44,20 @@ import org.opendaylight.yang.gen.v1.urn.mef.yang.mef.legato.services.rev171215.M
 import org.opendaylight.yang.gen.v1.urn.mef.yang.mef.legato.services.rev171215.mef.services.CarrierEthernet;
 import org.opendaylight.yang.gen.v1.urn.mef.yang.mef.legato.services.rev171215.mef.services.carrier.ethernet.SubscriberServices;
 import org.opendaylight.yang.gen.v1.urn.mef.yang.mef.legato.services.rev171215.mef.services.carrier.ethernet.subscriber.services.Evc;
+import org.opendaylight.yang.gen.v1.urn.mef.yang.mef.legato.services.rev171215.mef.services.carrier.ethernet.subscriber.services.EvcBuilder;
 import org.opendaylight.yang.gen.v1.urn.mef.yang.mef.legato.services.rev171215.mef.services.carrier.ethernet.subscriber.services.EvcKey;
+import org.opendaylight.yang.gen.v1.urn.mef.yang.mef.legato.services.rev171215.mef.services.carrier.ethernet.subscriber.services.evc.EndPointsBuilder;
+import org.opendaylight.yang.gen.v1.urn.mef.yang.mef.legato.services.rev171215.mef.services.carrier.ethernet.subscriber.services.evc.end.points.EndPoint;
+import org.opendaylight.yang.gen.v1.urn.mef.yang.mef.legato.services.rev171215.mef.services.carrier.ethernet.subscriber.services.evc.end.points.EndPointBuilder;
+import org.opendaylight.yang.gen.v1.urn.mef.yang.mef.legato.services.rev171215.mef.services.carrier.ethernet.subscriber.services.evc.end.points.end.point.CeVlansBuilder;
+import org.opendaylight.yang.gen.v1.urn.mef.yang.mef.types.rev171215.ConnectionType;
 import org.opendaylight.yang.gen.v1.urn.mef.yang.mef.types.rev171215.EvcIdType;
+import org.opendaylight.yang.gen.v1.urn.mef.yang.mef.types.rev171215.EvcUniRoleType;
 import org.opendaylight.yang.gen.v1.urn.mef.yang.mef.types.rev171215.Identifier1024;
+import org.opendaylight.yang.gen.v1.urn.mef.yang.mef.types.rev171215.Identifier45;
+import org.opendaylight.yang.gen.v1.urn.mef.yang.mef.types.rev171215.MaxFrameSizeType;
+import org.opendaylight.yang.gen.v1.urn.mef.yang.mef.types.rev171215.MefServiceType;
+import org.opendaylight.yang.gen.v1.urn.mef.yang.mef.types.rev171215.VlanIdType;
 import org.opendaylight.yang.gen.v1.urn.mef.yang.nrp._interface.rev180321.CreateConnectivityServiceInput1;
 import org.opendaylight.yang.gen.v1.urn.mef.yang.nrp._interface.rev180321.EndPoint2;
 import org.opendaylight.yang.gen.v1.urn.mef.yang.nrp._interface.rev180321.EndPoint7;
@@ -64,10 +75,11 @@ import org.powermock.modules.junit4.PowerMockRunner;
 
 import com.google.common.util.concurrent.FluentFuture;
 
-/**
-* @author Arif.Hussain@Xoriant.Com
-*
-*/
+/*
+ * @author Arif.Hussain@Xoriant.Com
+ */
+
+@SuppressWarnings("deprecation")
 @RunWith(PowerMockRunner.class)
 @PrepareForTest({LogicalDatastoreType.class, LegatoUtils.class, Optional.class})
 public class LegatoUtilsTest {
@@ -81,23 +93,60 @@ public class LegatoUtilsTest {
     @SuppressWarnings("rawtypes")
     @Mock
     private FluentFuture checkedFuture;
-    private static final EvcIdType EVC_NODE_ID = new EvcIdType("EVC1");
 
+    private EndPointBuilder endPointBuilder;
+    private Evc evc;
+    private EVCDao evcDao;
+
+    private static final EvcIdType EVC_NODE_ID = new EvcIdType("EVC1");
 
     @Before
     public void setUp() throws Exception {
         PowerMockito.mockStatic(LegatoUtils.class, Mockito.CALLS_REAL_METHODS);
+
+        final List<VlanIdType> vlanIdTypes = new ArrayList<>();
+        vlanIdTypes.add(new VlanIdType(301));
+
+        CeVlansBuilder ceVlansBuilder = new CeVlansBuilder();
+        ceVlansBuilder.setCeVlan(vlanIdTypes);
+
+        final List<EndPoint> endPointList = new ArrayList<EndPoint>();
+        endPointBuilder = new EndPointBuilder();
+        endPointBuilder.setCeVlans(ceVlansBuilder.build());
+        endPointBuilder.setUniId(new Identifier45(Constants.UNI_ID1));
+        endPointBuilder.setRole(EvcUniRoleType.Root);
+
+        endPointList.add(endPointBuilder.build());
+        endPointBuilder = new EndPointBuilder();
+        endPointBuilder.setCeVlans(ceVlansBuilder.build());
+        endPointBuilder.setUniId(new Identifier45(Constants.UNI_ID2));
+        endPointBuilder.setRole(EvcUniRoleType.Leaf);
+
+        endPointList.add(endPointBuilder.build());
+        endPointBuilder = new EndPointBuilder();
+        endPointBuilder.setCeVlans(ceVlansBuilder.build());
+        endPointBuilder.setUniId(new Identifier45(Constants.UNI_ID3));
+        endPointBuilder.setRole(EvcUniRoleType.Leaf);
+        endPointList.add(endPointBuilder.build());
+
+        evc = (Evc) new EvcBuilder().setEvcId(new EvcIdType(Constants.EVC_ID_TYPE))
+                .setEndPoints(new EndPointsBuilder().setEndPoint(endPointList).build())
+                .setMaxFrameSize(new MaxFrameSizeType(Constants.MAXFRAME_SIZE_TYPE))
+                .setEvcId(new EvcIdType(Constants.EVC_ID_TYPE))
+                .setConnectionType(ConnectionType.MultipointToMultipoint)
+                .setSvcType(MefServiceType.Eplan).build();
     }
 
 
     @SuppressWarnings("unchecked")
     @Test
     public void testReadEvc() throws ReadFailedException, InterruptedException, ExecutionException {
-
+        // having
         final InstanceIdentifier<Evc> evcID = InstanceIdentifier.create(MefServices.class)
                 .child(CarrierEthernet.class).child(SubscriberServices.class)
                 .child(Evc.class, new EvcKey(new EvcIdType(EVC_NODE_ID)));
 
+        // when
         ReadTransaction readTransaction = mock(ReadTransaction.class);
         when(dataBroker.newReadOnlyTransaction()).thenReturn(readTransaction);
         FluentFuture<Optional<Evc>> nodeFuture = mock(FluentFuture.class);
@@ -105,6 +154,8 @@ public class LegatoUtilsTest {
         when(readTransaction.read(any(LogicalDatastoreType.class), any(InstanceIdentifier.class)))
                 .thenReturn(nodeFuture);
         when(nodeFuture.get()).thenReturn(optNode);
+
+        // then
         Optional<Evc> expectedOpt =
                 LegatoUtils.readEvc(dataBroker, LogicalDatastoreType.CONFIGURATION, evcID);
         verify(readTransaction).read(any(LogicalDatastoreType.class), any(InstanceIdentifier.class));
@@ -117,10 +168,12 @@ public class LegatoUtilsTest {
     @Test
     public void testReadProfiles() throws ReadFailedException, InterruptedException, ExecutionException {
 
+        // having
         final InstanceIdentifier<Profile> profileID =
                 InstanceIdentifier.create(MefGlobal.class).child(SlsProfiles.class)
                         .child(Profile.class, new ProfileKey(new Identifier1024(Constants.ONE)));
 
+        // when
         ReadTransaction readTransaction = mock(ReadTransaction.class);
         when(dataBroker.newReadOnlyTransaction()).thenReturn(readTransaction);
         FluentFuture<Optional<Profile>> nodeFuture =
@@ -129,9 +182,12 @@ public class LegatoUtilsTest {
         when(readTransaction.read(any(LogicalDatastoreType.class), any(InstanceIdentifier.class)))
                 .thenReturn(nodeFuture);
         when(nodeFuture.get()).thenReturn(optNode);
+
+        // then
         Optional<Profile> expectedOpt =
                 (Optional<Profile>) LegatoUtils.readProfile(Constants.SLS_PROFILES,
                         dataBroker, LogicalDatastoreType.CONFIGURATION, profileID);
+
         verify(readTransaction).read(any(LogicalDatastoreType.class), any(InstanceIdentifier.class));
         assertNotNull(expectedOpt);
         assertEquals(expectedOpt, optNode);
@@ -142,14 +198,18 @@ public class LegatoUtilsTest {
     @SuppressWarnings("unchecked")
     @Test
     public void testAddToOperationalDB() {
+        // having
         final SlsProfiles slsProfile = mock(SlsProfiles.class);
-        final InstanceIdentifier<SlsProfiles> instanceIdentifier =
-                InstanceIdentifier.create(MefGlobal.class).child(SlsProfiles.class);
+        final InstanceIdentifier<SlsProfiles> instanceIdentifier = InstanceIdentifier
+            .create(MefGlobal.class).child(SlsProfiles.class);
 
+        // when
         when(dataBroker.newWriteOnlyTransaction()).thenReturn(transaction);
         doNothing().when(transaction).merge(any(LogicalDatastoreType.class),
                 any(InstanceIdentifier.class), any(Profile.class));
         when(transaction.commit()).thenReturn(checkedFuture);
+
+        // then
         LegatoUtils.addToOperationalDB(slsProfile, instanceIdentifier, dataBroker);
         verify(transaction).merge(any(LogicalDatastoreType.class), any(),
                 any());
@@ -160,14 +220,18 @@ public class LegatoUtilsTest {
     @SuppressWarnings("unchecked")
     @Test
     public void testDeleteFromOperationalDB() {
+        // having
         final InstanceIdentifier<Evc> evcID = InstanceIdentifier.create(MefServices.class)
                 .child(CarrierEthernet.class).child(SubscriberServices.class)
                 .child(Evc.class, new EvcKey(new EvcIdType(EVC_NODE_ID)));
 
+        // when
         when(dataBroker.newWriteOnlyTransaction()).thenReturn(transaction);
         doNothing().when(transaction).delete(any(LogicalDatastoreType.class),
                 any(InstanceIdentifier.class));
         when(transaction.commit()).thenReturn(checkedFuture);
+
+        // then
         assertEquals(true, LegatoUtils.deleteFromOperationalDB(evcID, dataBroker));
         verify(transaction).delete(any(LogicalDatastoreType.class), any(InstanceIdentifier.class));
         verify(transaction).commit();
@@ -177,58 +241,67 @@ public class LegatoUtilsTest {
     @Test
     @Ignore
     public void testBuildCreateConnectivityServiceInput() {
-        final Evc evc = mock(Evc.class);
-        final CreateConnectivityServiceInput input = mock(CreateConnectivityServiceInput.class);
-        final EVCDao evcDao = mock(EVCDao.class);
+        // having
+        assertNotNull(evc);
+        evcDao = LegatoUtils.parseNodes(evc);
 
         MemberModifier.suppress(MemberMatcher.method(LegatoUtils.class, Constants.PARSE_NODES));
         when(LegatoUtils.parseNodes(evc)).thenReturn(evcDao);
-        MemberModifier.suppress(
-                MemberMatcher.method(LegatoUtils.class, Constants.CREATE_CONNECTIVITY_INPUT));
-        when(LegatoUtils.buildCreateConnectivityServiceInput(evcDao))
-                .thenReturn(input);
-        assertNotNull(input);
-        assertEquals(input,
-                LegatoUtils.buildCreateConnectivityServiceInput(evcDao));
+
+        // when
+        CreateConnectivityServiceInput future = mock(CreateConnectivityServiceInput.class);
+
+        MemberModifier.suppress(MemberMatcher.method(LegatoUtils.class, Constants.CREATE_CONNECTIVITY_INPUT));
+        when(LegatoUtils.buildCreateConnectivityServiceInput(evcDao,
+            String.valueOf(Constants.VLAN_ID), evc.getEndPoints().getEndPoint()))
+                        .thenReturn(future);
+        // then
+        assertNotNull(future);
+        assertEquals(future, LegatoUtils.buildCreateConnectivityServiceInput(evcDao,
+            String.valueOf(Constants.VLAN_ID), evc.getEndPoints().getEndPoint()));
     }
 
 
     @Test
     @Ignore
     public void testBuildUpdateConnectivityServiceInput() {
-        final Evc evc = mock(Evc.class);
-        final UpdateConnectivityServiceInput input = mock(UpdateConnectivityServiceInput.class);
-        final EVCDao evcDao = mock(EVCDao.class);
+
+        // having
+        assertNotNull(evc);
+        evcDao = LegatoUtils.parseNodes(evc);
+
         MemberModifier.suppress(MemberMatcher.method(LegatoUtils.class, Constants.PARSE_NODES));
         when(LegatoUtils.parseNodes(evc)).thenReturn(evcDao);
 
-        final List<String> uniList = new ArrayList<String>();
-        uniList.add(Constants.UNI_ID1);
-        uniList.add(Constants.UNI_ID2);
-        MemberModifier.suppress(
-                MemberMatcher.method(LegatoUtils.class, Constants.UPDATE_CONNECTIVITY_INPUT));
-        when(LegatoUtils.buildUpdateConnectivityServiceInput(evcDao, uniList.get(0), Constants.UUID)).thenReturn(input);
+        // when
+        final UpdateConnectivityServiceInput input = mock(UpdateConnectivityServiceInput.class);
+
+        MemberModifier.suppress(MemberMatcher.method(LegatoUtils.class, Constants.UPDATE_CONNECTIVITY_INPUT));
+        when(LegatoUtils.buildUpdateConnectivityServiceInput(evcDao,
+            evcDao.getUniIdList().get(0), Constants.UUID)).thenReturn(input);
+
+        // then
         assertNotNull(input);
-        assertEquals(input, LegatoUtils.buildUpdateConnectivityServiceInput(evcDao, uniList.get(0),
-                Constants.UUID));
+        assertEquals(input, LegatoUtils.buildUpdateConnectivityServiceInput(evcDao,
+            evcDao.getUniIdList().get(0), Constants.UUID));
     }
 
 
     @Test
     @Ignore
     public void testBuildNrpCarrierEthConnectivityResource() {
-
+        // having
         final NrpCarrierEthConnectivityResource nrpCarrierEthConnectivityResource =
-                mock(NrpCarrierEthConnectivityResource.class);
+            mock(NrpCarrierEthConnectivityResource.class);
+
+        // when
+        MemberModifier.suppress(MemberMatcher.method(LegatoUtils.class, Constants.NRP_CARRIER_ETH_CON_RESOURCE));
+        when(LegatoUtils.buildNrpCarrierEthConnectivityResource(String.valueOf(Constants.MAXFRAME_SIZE_TYPE)))
+            .thenReturn(nrpCarrierEthConnectivityResource);
 
-        MemberModifier.suppress(
-                MemberMatcher.method(LegatoUtils.class, Constants.NRP_CARRIER_ETH_CON_RESOURCE));
-        when(LegatoUtils.buildNrpCarrierEthConnectivityResource(
-                String.valueOf(Constants.MAXFRAME_SIZE_TYPE)))
-                        .thenReturn(nrpCarrierEthConnectivityResource);
+        // then
         assertNotNull(nrpCarrierEthConnectivityResource);
-        assertEquals(nrpCarrierEthConnectivityResource,
-                LegatoUtils.buildNrpCarrierEthConnectivityResource(
+        assertEquals(nrpCarrierEthConnectivityResource, LegatoUtils.buildNrpCarrierEthConnectivityResource(
                         String.valueOf(Constants.MAXFRAME_SIZE_TYPE)));
     }
 
@@ -236,79 +309,93 @@ public class LegatoUtilsTest {
     @Test
     @Ignore
     public void testBuildNrpCarrierEthConnectivityEndPointResource() {
-        final NrpCarrierEthConnectivityEndPointResource input =
-                mock(NrpCarrierEthConnectivityEndPointResource.class);
+        // having
+        final NrpCarrierEthConnectivityEndPointResource input = mock(NrpCarrierEthConnectivityEndPointResource.class);
+
+        // when
         MemberModifier.suppress(MemberMatcher.method(LegatoUtils.class,
-                Constants.NRP_CARRIER_ETH_CON_ENDPOINT_RESOURCE));
+            Constants.NRP_CARRIER_ETH_CON_ENDPOINT_RESOURCE));
         when(LegatoUtils.buildNrpCarrierEthConnectivityEndPointResource(
-                String.valueOf(Constants.VLAN_ID_TYPE))).thenReturn(input);
+            String.valueOf(Constants.VLAN_ID))).thenReturn(input);
+
+        // then
         assertNotNull(input);
         assertEquals(input, LegatoUtils.buildNrpCarrierEthConnectivityEndPointResource(
-                String.valueOf(Constants.VLAN_ID_TYPE)));
+            String.valueOf(Constants.VLAN_ID)));
     }
 
 
     @Test
     @Ignore
     public void testBuildCreateEthConnectivityEndPointAugmentation() {
+        // having
         final EndPoint2 createEndPoint = mock(EndPoint2.class);
 
+        // when
         MemberModifier.suppress(MemberMatcher.method(LegatoUtils.class,
-                Constants.CREATE_ETH_CON_ENDPOINT_AUGMENTATION));
-        when(LegatoUtils.buildCreateEthConnectivityEndPointAugmentation(
-                String.valueOf(Constants.VLAN_ID_TYPE))).thenReturn(createEndPoint);
+            Constants.CREATE_ETH_CON_ENDPOINT_AUGMENTATION));
+        when(LegatoUtils.buildCreateEthConnectivityEndPointAugmentation(String.valueOf(Constants.VLAN_ID)))
+            .thenReturn(createEndPoint);
+
+        // then
         assertNotNull(createEndPoint);
         assertEquals(createEndPoint, LegatoUtils.buildCreateEthConnectivityEndPointAugmentation(
-                String.valueOf(Constants.VLAN_ID_TYPE)));
+            String.valueOf(Constants.VLAN_ID)));
     }
 
 
     @Test
     @Ignore
     public void testBuildUpdateEthConnectivityEndPointAugmentation() {
+        // having
         final EndPoint7 updateEndPoint = mock(EndPoint7.class);
 
+        //when
         MemberModifier.suppress(MemberMatcher.method(LegatoUtils.class,
-                Constants.UPDATE_ETH_CON_ENDPOINT_AUGMENTATION));
-        when(LegatoUtils.buildUpdateEthConnectivityEndPointAugmentation(
-                String.valueOf(Constants.VLAN_ID_TYPE))).thenReturn(updateEndPoint);
+            Constants.UPDATE_ETH_CON_ENDPOINT_AUGMENTATION));
+        when(LegatoUtils.buildUpdateEthConnectivityEndPointAugmentation(String.valueOf(Constants.VLAN_ID)))
+            .thenReturn(updateEndPoint);
+
+        // then
         assertNotNull(updateEndPoint);
         assertEquals(updateEndPoint, LegatoUtils.buildUpdateEthConnectivityEndPointAugmentation(
-                String.valueOf(Constants.VLAN_ID_TYPE)));
+            String.valueOf(Constants.VLAN_ID)));
     }
 
 
     @Test
     @Ignore
     public void testBuildCreateConServiceAugmentation() {
-        final CreateConnectivityServiceInput1 createConServInput =
-                mock(CreateConnectivityServiceInput1.class);
-
-        MemberModifier.suppress(
-                MemberMatcher.method(LegatoUtils.class, Constants.CREATE_CON_SERVICE_AUGMENTATION));
-        when(LegatoUtils
-                .buildCreateConServiceAugmentation(String.valueOf(Constants.MAXFRAME_SIZE_TYPE)))
-                        .thenReturn(createConServInput);
+        // having
+        final CreateConnectivityServiceInput1 createConServInput = mock(CreateConnectivityServiceInput1.class);
+
+        // when
+        MemberModifier.suppress(MemberMatcher.method(LegatoUtils.class, Constants.CREATE_CON_SERVICE_AUGMENTATION));
+        when(LegatoUtils.buildCreateConServiceAugmentation(String.valueOf(Constants.MAXFRAME_SIZE_TYPE)))
+            .thenReturn(createConServInput);
+
+        // then
         assertNotNull(createConServInput);
-        assertEquals(createConServInput, LegatoUtils
-                .buildCreateConServiceAugmentation(String.valueOf(Constants.MAXFRAME_SIZE_TYPE)));
+        assertEquals(createConServInput, LegatoUtils.buildCreateConServiceAugmentation(
+            String.valueOf(Constants.MAXFRAME_SIZE_TYPE)));
     }
 
 
     @Test
     @Ignore
     public void testBuildUpdateConServiceAugmentation() {
-        final UpdateConnectivityServiceInput1 updateConServInput =
-                mock(UpdateConnectivityServiceInput1.class);
+        // having
+        final UpdateConnectivityServiceInput1 updateConServInput = mock(UpdateConnectivityServiceInput1.class);
 
-        MemberModifier.suppress(
-                MemberMatcher.method(LegatoUtils.class, Constants.UPDATE_CON_SERVICE_AUGMENTATION));
-        when(LegatoUtils
-                .buildUpdateConServiceAugmentation(String.valueOf(Constants.MAXFRAME_SIZE_TYPE)))
+        // when
+        MemberModifier.suppress(MemberMatcher.method(LegatoUtils.class, Constants.UPDATE_CON_SERVICE_AUGMENTATION));
+        when(LegatoUtils.buildUpdateConServiceAugmentation(String.valueOf(Constants.MAXFRAME_SIZE_TYPE)))
                         .thenReturn(updateConServInput);
+
+        // then
         assertNotNull(updateConServInput);
-        assertEquals(updateConServInput, LegatoUtils
-                .buildUpdateConServiceAugmentation(String.valueOf(Constants.MAXFRAME_SIZE_TYPE)));
+        assertEquals(updateConServInput, LegatoUtils.buildUpdateConServiceAugmentation(
+            String.valueOf(Constants.MAXFRAME_SIZE_TYPE)));
     }
 
 }
diff --git a/legato-api/src/test/resources/mockito-extensions/org.mockito.plugins.MockMaker b/legato-api/src/test/resources/mockito-extensions/org.mockito.plugins.MockMaker
new file mode 100644 (file)
index 0000000..1f0955d
--- /dev/null
@@ -0,0 +1 @@
+mock-maker-inline
index 04c66f8e6546f21a8cc0c341d44903a9ef8b6db6..eec38da18d32d6bd347c4762edde5d0884efdef6 100644 (file)
@@ -20,15 +20,19 @@ import org.opendaylight.unimgr.mef.nrp.common.ResourceActivator;
 import org.opendaylight.unimgr.mef.nrp.common.ResourceNotAvailableException;
 import org.opendaylight.unimgr.mef.nrp.ovs.transaction.TableTransaction;
 import org.opendaylight.unimgr.mef.nrp.ovs.transaction.TopologyTransaction;
+import org.opendaylight.unimgr.mef.nrp.ovs.util.EtreeUtils;
 import org.opendaylight.unimgr.mef.nrp.ovs.util.OpenFlowUtils;
 import org.opendaylight.unimgr.mef.nrp.ovs.util.OvsdbUtils;
 import org.opendaylight.unimgr.mef.nrp.ovs.util.VlanUtils;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev180307.PortRole;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev180307.ServiceType;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.Table;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.Flow;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node;
 import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Link;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
+import org.opendaylight.unimgr.mef.nrp.api.FailureResult;
 
 /**
  * Ovs driver activator.
@@ -54,20 +58,24 @@ public class OvsActivator implements ResourceActivator {
      * @throws ResourceNotAvailableException missing resource
      */
     @Override
-    public void activate(List<EndPoint> endPoints, String serviceName)
+    public void activate(List<EndPoint> endPoints, String serviceName, boolean isExclusive, ServiceType serviceType)
             throws ResourceNotAvailableException, InterruptedException, ExecutionException {
+
         OvsActivatorHelper.validateExternalVLANs(endPoints);
 
         VlanUtils vlanUtils = new VlanUtils(dataBroker, endPoints.iterator().next().getNepRef().getNodeId().getValue());
+        EtreeUtils eTreeUtils = new EtreeUtils();
+        long rootCount = endPoints.stream().filter(node -> (node.getEndpoint().getRole()!=null  && node.getEndpoint().getRole().equals(PortRole.ROOT))).count();
 
         for (EndPoint endPoint:endPoints) {
-            activateEndpoint(endPoint, serviceName, vlanUtils);
+            activateEndpoint(endPoint, serviceName, vlanUtils, isExclusive, serviceType, rootCount, eTreeUtils);
         }
 
     }
 
-    private void activateEndpoint(EndPoint endPoint, String serviceName, VlanUtils vlanUtils)
+    private void activateEndpoint(EndPoint endPoint, String serviceName, VlanUtils vlanUtils, boolean isExclusive, ServiceType serviceType, long rootCount, EtreeUtils eTreeUtils)
             throws ResourceNotAvailableException, InterruptedException, ExecutionException {
+
         // Transaction - Get Open vSwitch node and its flow table
         String portName = OvsActivatorHelper.getPortName(endPoint.getEndpoint().getServiceInterfacePoint()
                 .getServiceInterfacePointId().getValue());
@@ -88,9 +96,23 @@ public class OvsActivator implements ResourceActivator {
         OvsActivatorHelper ovsActivatorHelper = new OvsActivatorHelper(topologyTransaction, endPoint);
         String openFlowPortName = ovsActivatorHelper.getOpenFlowPortName();
         long queueNumber = QUEUE_NUMBER_GENERATOR.getAndIncrement();
-        flowsToWrite.addAll(OpenFlowUtils
-                .getVlanFlows(openFlowPortName, vlanUtils.getVlanID(serviceName),
-                        ovsActivatorHelper.getCeVlanId(),interswitchLinks, serviceName, queueNumber));
+        LOG.trace("VLAN ID = {} ", ovsActivatorHelper.getCeVlanId().isPresent());
+
+        if(isExclusive && ! ovsActivatorHelper.getCeVlanId().isPresent()){
+            // Port based E-tree service
+            if(serviceType != null && serviceType.equals(ServiceType.ROOTEDMULTIPOINTCONNECTIVITY)) {
+                flowsToWrite.addAll(OpenFlowUtils.getEpTree(endPoint.getEndpoint().getRole().getName(), openFlowPortName, vlanUtils.getVlanID(serviceName), ovsActivatorHelper.getCeVlanId(),interswitchLinks, serviceName, queueNumber, rootCount, eTreeUtils, isExclusive));
+            } else {
+                flowsToWrite.addAll(OpenFlowUtils.getFlows(openFlowPortName, interswitchLinks, serviceName, queueNumber));
+            }
+        }
+        else{
+            if(serviceType != null && serviceType.equals(ServiceType.ROOTEDMULTIPOINTCONNECTIVITY)) {
+                flowsToWrite.addAll(OpenFlowUtils.getEvpTree(endPoint.getEndpoint().getRole().getName(), openFlowPortName, vlanUtils.getVlanID(serviceName), ovsActivatorHelper.getCeVlanId(),interswitchLinks, serviceName, queueNumber, rootCount, eTreeUtils));
+            }else {
+                flowsToWrite.addAll(OpenFlowUtils.getVlanFlows(openFlowPortName, vlanUtils.getVlanID(serviceName), ovsActivatorHelper.getCeVlanId(),interswitchLinks, serviceName, queueNumber));
+            }
+        }
 
         // Transaction - Add flows related to service to table and remove unnecessary flows
         TableTransaction tableTransaction = new TableTransaction(dataBroker, node, table);
@@ -110,14 +132,23 @@ public class OvsActivator implements ResourceActivator {
     }
 
     @Override
-    public void deactivate(List<EndPoint> endPoints, String serviceName)
+    public void deactivate(List<EndPoint> endPoints, String serviceName, ServiceType serviceType)
             throws InterruptedException, ExecutionException, ResourceNotAvailableException {
 
+        boolean isExclusive = false;
+
         for (EndPoint endPoint:endPoints) {
             deactivateEndpoint(endPoint, serviceName);
         }
-        new VlanUtils(dataBroker, endPoints.iterator().next()
-                .getNepRef().getNodeId().getValue()).releaseServiceVlan(serviceName);
+        new VlanUtils(dataBroker, endPoints.iterator().next().getNepRef().getNodeId().getValue()).releaseServiceVlan(serviceName);
+        try {
+            isExclusive = new EtreeUtils().getServiceType(dataBroker, serviceName);
+            if (serviceType != null && serviceType.equals(ServiceType.ROOTEDMULTIPOINTCONNECTIVITY) && ! isExclusive) {
+                new EtreeUtils().releaseTreeServiceVlan(serviceName);
+            }
+        } catch (FailureResult e) {
+            LOG.error("Unable to find out service type result with serviceid { " + serviceName + " }", e);
+        }
 
     }
 
index 25d55b42933897dbad3df1587b1b93c11ce2c5f5..3a0f96988c03004c6ac7655154f0d2d73a558aa1 100644 (file)
@@ -21,6 +21,7 @@ import org.opendaylight.unimgr.mef.nrp.common.ResourceNotAvailableException;
 import org.opendaylight.unimgr.mef.nrp.ovs.activator.OvsActivator;
 import org.opendaylight.unimgr.mef.nrp.ovs.tapi.TopologyDataHandler;
 import org.opendaylight.yang.gen.v1.urn.mef.yang.nrp._interface.rev180321.NrpConnectivityServiceAttrs;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev180307.ServiceType;
 
 /**
  * Ovs driver builder.
@@ -39,6 +40,8 @@ public class OvsDriver implements ActivationDriverBuilder {
         return new ActivationDriver() {
             List<EndPoint> endPoints;
             String serviceId;
+            ServiceType serviceType;
+            boolean isExclusive;
 
             @Override
             public void commit() {
@@ -51,14 +54,16 @@ public class OvsDriver implements ActivationDriverBuilder {
             }
 
             @Override
-            public void initialize(List<EndPoint> endPoints, String serviceId, NrpConnectivityServiceAttrs context) {
+            public void initialize(List<EndPoint> endPoints, String serviceId, NrpConnectivityServiceAttrs context, boolean isExclusive, ServiceType serviceType) {
                 this.endPoints = new ArrayList<>(endPoints);
                 this.serviceId = serviceId;
+                this.isExclusive = isExclusive;
+                this.serviceType = serviceType;
             }
 
             @Override
             public void activate() throws ResourceNotAvailableException, InterruptedException, ExecutionException {
-                activator.activate(endPoints,serviceId);
+                activator.activate(endPoints, serviceId, isExclusive, serviceType);
             }
 
             @Override
@@ -68,7 +73,7 @@ public class OvsDriver implements ActivationDriverBuilder {
 
             @Override
             public void deactivate() throws ResourceNotAvailableException, InterruptedException, ExecutionException {
-                activator.deactivate(endPoints,serviceId);
+                activator.deactivate(endPoints, serviceId, serviceType);
             }
 
             @Override
@@ -76,7 +81,6 @@ public class OvsDriver implements ActivationDriverBuilder {
                 return 0;
             }
 
-
         };
     }
 
diff --git a/ovs-driver/src/main/java/org/opendaylight/unimgr/mef/nrp/ovs/util/EtreeUtils.java b/ovs-driver/src/main/java/org/opendaylight/unimgr/mef/nrp/ovs/util/EtreeUtils.java
new file mode 100644 (file)
index 0000000..c8941d9
--- /dev/null
@@ -0,0 +1,234 @@
+/*
+ * Copyright (c) 2018 Xoriant Corporation and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.unimgr.mef.nrp.ovs.util;
+
+import java.util.HashSet;
+import java.util.Hashtable;
+import java.util.List;
+import java.util.Map;
+import java.util.Objects;
+import java.util.Optional;
+import java.util.Set;
+import java.util.TreeSet;
+import java.util.stream.Collectors;
+import java.util.stream.IntStream;
+import java.util.stream.Stream;
+
+import org.opendaylight.mdsal.binding.api.DataBroker;
+import org.opendaylight.unimgr.mef.nrp.api.FailureResult;
+import org.opendaylight.unimgr.mef.nrp.common.NrpDao;
+import org.opendaylight.unimgr.mef.nrp.common.ResourceNotAvailableException;
+import org.opendaylight.unimgr.mef.nrp.ovs.exception.VlanPoolExhaustedException;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Uuid;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev180307.connectivity.context.ConnectivityService;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.google.common.collect.Sets;
+
+/**
+ * @author Arif.Hussain@Xoriant.Com
+ *
+ */
+public class EtreeUtils {
+
+    private static final Set<Integer> usedVlans = new HashSet<>();
+    private static final Set<Integer> usedEpTreeVlans = new HashSet<>();
+    private static final Map<Integer, String> usedEpTreeService = new Hashtable<Integer, String>();
+    private static final Map<String, Integer> usedService = new Hashtable<String, Integer>();
+    private static final Map<Integer, String> prePopMap = new Hashtable<Integer, String>();
+    private static final Set<Integer> possibleRootVlans =
+            IntStream.range(2048, 4094).boxed().collect(Collectors.toSet());
+    private static Set<Integer> cpeRange = null;
+    private static Set<Integer> speRange = null;
+    private static final String VLAN_POOL_EXHAUSTED_ERROR_MESSAGE =
+            "All VLAN IDs are in use. VLAN pool exhausted.";
+    private ConnectivityService value;
+    private static final Logger LOG = LoggerFactory.getLogger(EtreeUtils.class);
+
+
+    /**
+     * Method return vlan ID for e-tree service. If service is unique generate new one otherwise
+     * return same vlan-ID belong to service .
+     *
+     * @param serviceName
+     * @return vlan id
+     * @throws ResourceNotAvailableException when no more vlan ids available
+     */
+    public Integer getVlanID(String serviceName)
+            throws ResourceNotAvailableException {
+        Optional<Integer> o = usedService.entrySet().stream()
+                .filter(e -> e.getKey().equals(serviceName)).map(Map.Entry::getValue).findFirst();
+
+        return o.isPresent() ? o.get().intValue() : generateVid(serviceName);
+    }
+
+    private Integer generateVid(String serviceName) throws VlanPoolExhaustedException {
+        Set<Integer> difference = Sets.difference(possibleRootVlans, usedVlans);
+        if (difference.isEmpty()) {
+            LOG.warn(VLAN_POOL_EXHAUSTED_ERROR_MESSAGE);
+            throw new VlanPoolExhaustedException(VLAN_POOL_EXHAUSTED_ERROR_MESSAGE);
+        }
+
+        return updateNodeNewServiceVLAN(serviceName, difference.iterator().next());
+    }
+
+    private Integer updateNodeNewServiceVLAN(String serviceName, Integer vlanId) {
+        usedService.put(serviceName, vlanId);
+        usedVlans.add(vlanId);
+
+        return vlanId;
+    }
+
+    public void releaseTreeServiceVlan(String serviceName) {
+        usedVlans.remove(usedService.entrySet().stream().filter(e -> e.getKey().equals(serviceName))
+                .map(Map.Entry::getValue).findFirst().get());
+        usedService.entrySet()
+                .removeIf(serviceVlanMap -> serviceVlanMap.getKey().equals(serviceName));
+    }
+
+    /**
+     * Method return cpe vlans range for e-tree service. Every service will keep same range .
+     *
+     * @return spe range e.g- 1-100
+     */
+    public static Set<Integer> cpeVlanRange() {
+        LOG.info("Avaliable cpe range ... ");
+        List<Integer> range =
+                IntStream.rangeClosed(OVSConstant.CPESTARTINCLUSIVE, OVSConstant.CPEENDEXCLUSIVE)
+                        .boxed().collect(Collectors.toList());
+        cpeRange = new TreeSet<Integer>(range);
+        return cpeRange;
+    }
+
+    /**
+     * Method return spe vlans range for e-tree service. If service is unique generate new one spe
+     * range otherwise return same .
+     *
+     * @param vlan the vlan id
+     * @return spe range e.g- 1-100
+     */
+    public static Set<Integer> speVlanRange(int vlan) {
+        int[] speRG = isAvailableVlan(vlan);
+        LOG.info("Avaliable spe range ... ");
+        List<Integer> range =
+                IntStream.rangeClosed(speRG[0], speRG[1]).boxed().collect(Collectors.toList());
+        speRange = new TreeSet<Integer>(range);
+
+        return speRange;
+    }
+
+    /**
+     * Method will generate vlans map [e.g (1, 1000-1019)] by available cpe .
+     */
+    public static void generatePrePopVlan() {
+        assert cpeRange != null;
+
+        int count = (int) cpeRange.stream().count();
+        int start = Integer.sum(OVSConstant.SPEDEFAULTVAL, count);
+        int end = Integer.sum(start, count - 1);
+
+        for (int i = 1; i < 4094; i++) {
+            prePopMap.put(i, (start) + "-" + end);
+            start = Integer.sum(start, count);
+            end = Integer.sum(end, count);
+            if (start > 4094 || end > 4094) {
+                break;
+            }
+        }
+    }
+
+
+    /**
+     * Method will pick available spe range by specific vlan and split into array .
+     *
+     * @param vlan the vlan id
+     * @return int array
+     */
+    public static int[] isAvailableVlan(int vlan) {
+        String rg[] = null;
+        Optional<String> firstKey =
+                prePopMap.entrySet().stream().filter(entry -> Objects.equals(entry.getKey(), vlan))
+                        .map(Map.Entry::getValue).findFirst();
+
+        if (firstKey.isPresent()) {
+            LOG.info("SPE map generated successfully for ep-tree. ");
+            rg = firstKey.get().split("-");
+        }
+
+        return Stream.of(rg).mapToInt(Integer::parseInt).toArray();
+    }
+
+
+    /**
+     * Method return unique vlanID for ep-tree service.
+     *
+     * @param serviceName the service name
+     * @param type the type of service
+     * @return vlan id
+     * @throws ResourceNotAvailableException when no more vlan ids available
+     */
+    public Integer getEpVlanID(String serviceName, String type)
+            throws ResourceNotAvailableException {
+        Set<Integer> difference = null;
+
+        if (type.equalsIgnoreCase(OVSConstant.CPETYPE)) {
+            difference = Sets.difference(cpeRange, usedEpTreeVlans);
+        } else {
+            difference = Sets.difference(speRange, usedEpTreeVlans);
+        }
+
+        if (difference.isEmpty()) {
+            LOG.warn(VLAN_POOL_EXHAUSTED_ERROR_MESSAGE);
+            throw new VlanPoolExhaustedException(VLAN_POOL_EXHAUSTED_ERROR_MESSAGE);
+        }
+
+        return updateEpNodeNewServiceVLAN(serviceName, difference.iterator().next());
+    }
+
+    private Integer updateEpNodeNewServiceVLAN(String serviceName, Integer vlanId) {
+        usedEpTreeService.put(vlanId, serviceName);
+        usedEpTreeVlans.add(vlanId);
+
+        return vlanId;
+    }
+
+    /**
+     * Method release all used vlanID for ep-tree service.
+     *
+     * @param serviceName name of service
+     */
+    public void releaseEpTreeServiceVlan(String serviceName) {
+        usedEpTreeVlans.removeAll(
+                usedEpTreeService.entrySet().stream().filter(e -> e.getValue().equals(serviceName))
+                        .map(Map.Entry::getKey).collect(Collectors.toSet()));
+        usedEpTreeService.entrySet()
+                .removeIf(serviceVlanMap -> serviceVlanMap.getValue().equals(serviceName));
+    }
+
+    /**
+     * Method fetch service type (tagged or port) based on the nodeId and return true or false in
+     * IsExclusive flag .
+     *
+     * @param dataBroker data broker
+     * @param nodeId node identifier
+     * @return boolean true/false
+     * @throws FailureResult on missing service
+     */
+    public boolean getServiceType(DataBroker dataBroker, String nodeId) throws FailureResult {
+        value = new NrpDao(dataBroker.newReadOnlyTransaction())
+                .getConnectivityService(nodeId);
+
+        if (value == null) {
+            throw new FailureResult("There is no service with id {0}", nodeId);
+        }
+
+        return value.isIsExclusive();
+    }
+
+}
index 3b9d1dffeca8fe913bd4e4d7304cec6515594132..c660ceb98e56284d995361e264cbc25ceda09003 100644 (file)
@@ -35,4 +35,15 @@ class MatchUtils {
                            .setVlanMatch(vlanMatchBuilder.build())
                            .build();
     }
+
+    static Match createWithoutVlanMatch(String port) {
+        MatchBuilder matchBuilder = new MatchBuilder();
+       // VlanIdBuilder vlanIdBuilder = new VlanIdBuilder().setVlanIdPresent(true).setVlanId(new VlanId(vlanID));
+       // VlanMatchBuilder vlanMatchBuilder = new VlanMatchBuilder().setVlanId(vlanIdBuilder.build());
+
+        return matchBuilder.setInPort(new NodeConnectorId(port))
+                           //.setVlanMatch(vlanMatchBuilder.build())
+                           .build();
+    }
+
 }
index 30061ded0fac561e00bfe7b1582c892e0f5cb021..94291ddc50278aa6878518e937019ea255f91194 100644 (file)
@@ -33,11 +33,6 @@ public class NullAwareDatastoreGetter<T> {
         this.dataOptional = dataOptional;
     }
 
-    //TODO temporary, remove after java.util.Optional and com.google.common.base.Optional unification in ODL core
-    public NullAwareDatastoreGetter(com.google.common.base.Optional<T> dataOptional) {
-        this.dataOptional = dataOptional.isPresent() ? Optional.ofNullable(dataOptional.get()) : Optional.empty();
-    }
-
     public <R extends ChildOf<? super T>> NullAwareDatastoreGetter<R> collect(Function<T, Supplier<R>> function) {
         logDataOptionalStatus(function);
 
diff --git a/ovs-driver/src/main/java/org/opendaylight/unimgr/mef/nrp/ovs/util/OVSConstant.java b/ovs-driver/src/main/java/org/opendaylight/unimgr/mef/nrp/ovs/util/OVSConstant.java
new file mode 100644 (file)
index 0000000..81a7cc4
--- /dev/null
@@ -0,0 +1,29 @@
+/*
+ * Copyright (c) 2018 Xoriant Corporation and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.unimgr.mef.nrp.ovs.util;
+
+/**
+ * @author Arif.Hussain@Xoriant.Com
+ *
+ */
+public class OVSConstant {
+
+    private OVSConstant() {
+
+        throw new IllegalStateException(OVSConstant.UTILITY1);
+    }
+
+    public static final int CPESTARTINCLUSIVE = 10;
+    public static final int CPEENDEXCLUSIVE = 19;
+    public static final int SPEDEFAULTVAL = 1000;
+    public static final String CPETYPE = "CPE";
+    public static final String SPETYPE = "SPE";
+    public static final String UTILITY1 = "Utility-class";
+
+
+}
index d6399ca6a065ce2590702f7ab0c626a6c585cda0..ea272fb6774d7d805be8ea8e836b4d8e87c0e1ed 100644 (file)
@@ -12,7 +12,9 @@ import java.util.Arrays;
 import java.util.List;
 import java.util.Optional;
 import java.util.stream.Collectors;
+
 import org.opendaylight.unimgr.mef.nrp.common.ResourceNotAvailableException;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev180307.PortRole;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.Action;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNode;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowId;
@@ -38,6 +40,7 @@ public class OpenFlowUtils {
     private static final Short FLOW_TABLE_ID = 0;
     private static final int VLAN_FLOW_PRIORITY = 20;
     private static final int INTERSWITCH_FLOW_PRIORITY = 10;
+    private static final int EMPTY_VLAN_FLOW_PRIORITY = 20;
     private static final int DROP_FLOW_PRIORITY = 0;
     private static final long ETH_TYPE_LLDP = 35020;
 
@@ -115,6 +118,314 @@ public class OpenFlowUtils {
         return flows;
     }
 
+    /**
+     * Method is used for tagged (EVP) base tree service .
+     *
+     * @param role differentiate coming endpoint is root or leaf
+     * @param servicePort port on which service is activated (format: openflow:[node]:[port])
+     * @param internalVlanId VLAN ID used internally in OvSwitch network
+     * @param externalVlanId VLAN ID for VLAN aware services. If -1 then ignored and port-base
+     *        service created.
+     * @param interswitchLinks list of interswitch links for the node on which service is activated
+     * @param serviceName service name (used as prefix for flow IDs)
+     * @param queueNumber qos queue number
+     * @param rootCount shows number of root
+     * @param eTreeUtils is utility object
+     * @return list of flows
+     * @throws ResourceNotAvailableException if node is not augmented with FlowCapableNode class or
+     *         flow table is not present in node
+     */
+    public static List<Flow> getEvpTree(String role, String servicePort, int internalVlanId,
+            Optional<Integer> externalVlanId, List<Link> interswitchLinks, String serviceName,
+            long queueNumber, long rootCount, EtreeUtils eTreeUtils)
+            throws ResourceNotAvailableException {
+        List<Flow> flows = new ArrayList<>();
+
+        if (rootCount > 1) {
+            // Case: More then one Roots
+            if (role.equalsIgnoreCase(PortRole.ROOT.getName())) {
+                flows.addAll(createVlanPassingFlows(servicePort, internalVlanId, externalVlanId,
+                        serviceName, interswitchLinks));
+                flows.addAll(createVlanPassingFlows(servicePort, eTreeUtils.getVlanID(serviceName),
+                        externalVlanId, serviceName, interswitchLinks));
+                flows.add(createVlanIngressFlow(servicePort, eTreeUtils.getVlanID(serviceName),
+                        externalVlanId, serviceName, interswitchLinks, queueNumber));
+            } else {
+                flows.addAll(createVlanPassingFlows(servicePort, eTreeUtils.getVlanID(serviceName),
+                        externalVlanId, serviceName, interswitchLinks));
+                flows.add(createVlanIngressFlow(servicePort, internalVlanId, externalVlanId,
+                        serviceName, interswitchLinks, queueNumber));
+            }
+        } else {
+            // Case: Only one Root and more then one Leaf
+            if (role.equalsIgnoreCase(PortRole.ROOT.getName())) {
+                flows.addAll(createVlanPassingFlows(servicePort, internalVlanId, externalVlanId,
+                        serviceName, interswitchLinks));
+                flows.add(createVlanIngressFlow(servicePort, eTreeUtils.getVlanID(serviceName),
+                        externalVlanId, serviceName, interswitchLinks, queueNumber));
+            } else {
+                flows.addAll(createVlanPassingFlows(servicePort, eTreeUtils.getVlanID(serviceName),
+                        externalVlanId, serviceName, interswitchLinks));
+                flows.add(createVlanIngressFlow(servicePort, internalVlanId, externalVlanId,
+                        serviceName, interswitchLinks, queueNumber));
+            }
+        }
+
+        return flows;
+    }
+
+
+    /**
+     * Method is used for port base (EP) tree service .
+     *
+     * @param role differentiate coming endpoint is root or leaf
+     * @param servicePort port on which service is activated (format: openflow:[node]:[port])
+     * @param internalVlanId VLAN ID used internally in OvSwitch network
+     * @param externalVlanId VLAN ID for VLAN aware services. If -1 then ignored and port-base
+     *        service created.
+     * @param interswitchLinks list of interswitch links for the node on which service is activated
+     * @param serviceName service name (used as prefix for flow IDs)
+     * @param queueNumber qos queue number
+     * @param rootCount shows number of root
+     * @param eTreeUtils is utility object
+     * @param isExclusive show requested service is port or tag based
+     * @return list of flows
+     * @throws ResourceNotAvailableException if node is not augmented with FlowCapableNode class or
+     *         flow table is not present in node
+     */
+    public static List<Flow> getEpTree(String role, String servicePort, int internalVlanId,
+            Optional<Integer> externalVlanId, List<Link> interswitchLinks, String serviceName,
+            long queueNumber, long rootCount, EtreeUtils eTreeUtils, boolean isExclusive)
+            throws ResourceNotAvailableException {
+        List<Flow> flows = new ArrayList<>();
+
+        EtreeUtils.cpeVlanRange();
+        EtreeUtils.generatePrePopVlan();
+        EtreeUtils.speVlanRange(internalVlanId);
+        defaultFlows(role, flows, servicePort, internalVlanId, externalVlanId, interswitchLinks,
+                serviceName, queueNumber, rootCount, eTreeUtils, isExclusive);
+        unTaggedFlows(role, flows, servicePort, internalVlanId, interswitchLinks, serviceName,
+                queueNumber, rootCount, eTreeUtils, isExclusive);
+
+        return flows;
+    }
+
+    /**
+     * @param role differentiate coming endpoint is root or leaf
+     * @param flows object
+     * @param servicePort port on which service is activated (format: openflow:[node]:[port])
+     * @param internalVlanId VLAN ID used internally in OvSwitch network
+     * @param externalVlanId VLAN ID for VLAN aware services. If -1 then ignored and port-base
+     *        service created.
+     * @param interswitchLinks list of interswitch links for the node on which service is activated
+     * @param serviceName service name (used as prefix for flow IDs)
+     * @param queueNumber qos queue number
+     * @param rootCount shows number of root
+     * @param eTreeUtils is utility object
+     * @param isExclusive show requested service is port or tag based
+     * @return list of flows
+     */
+    private static List<Flow> defaultFlows(String role, List<Flow> flows, String servicePort,
+            int internalVlanId, Optional<Integer> externalVlanId, List<Link> interswitchLinks,
+            String serviceName, long queueNumber, long rootCount, EtreeUtils eTreeUtils,
+            boolean isExclusive) {
+
+        if (rootCount > 1) {
+             if (role.equalsIgnoreCase(PortRole.ROOT.getName())) {
+                 flows.addAll(createVlanPassingFlows(servicePort, internalVlanId, externalVlanId,
+                         serviceName, interswitchLinks));
+                 flows.addAll(createVlanPassingFlows(servicePort, OVSConstant.SPEDEFAULTVAL,
+                         externalVlanId, serviceName, interswitchLinks));
+                 flows.add(createVlanIngressFlow(servicePort, internalVlanId, externalVlanId,
+                         serviceName, interswitchLinks, queueNumber));
+             } else {
+                 flows.addAll(createVlanPassingFlows(servicePort, internalVlanId, externalVlanId,
+                         serviceName, interswitchLinks));
+                 flows.add(createVlanIngressFlow(servicePort, OVSConstant.SPEDEFAULTVAL,
+                         externalVlanId, serviceName, interswitchLinks, queueNumber));
+             }
+         } else {
+             if (role.equalsIgnoreCase(PortRole.ROOT.getName())) {
+                 flows.addAll(createVlanPassingFlows(servicePort, internalVlanId, externalVlanId,
+                         serviceName, interswitchLinks));
+                 flows.addAll(createIngressFlow(servicePort, serviceName, interswitchLinks));
+             } else {
+                 flows.addAll(createPassingFlows(servicePort, serviceName, interswitchLinks));
+                 flows.add(createVlanIngressFlow(servicePort, internalVlanId, externalVlanId,
+                         serviceName, interswitchLinks, queueNumber));
+             }
+         }
+        return flows;
+    }
+
+    private static List<Flow> createPassingFlows(String outputPort, String serviceName,
+            List<Link> interswitchLinks) {
+        return interswitchLinks.stream().map(
+                link -> createPassingFlow(outputPort, link.getLinkId().getValue(), serviceName))
+                .collect(Collectors.toList());
+    }
+
+    private static Flow createPassingFlow(String outputPort, String inputPort, String serviceName) {
+        LOG.info(" inside createPassingFlow () outputPort{}, inputPort{} ", outputPort, inputPort);
+        List<Action> actions = new ArrayList<>();
+        int actionOrder = 0;
+
+        // actions.add(ActionUtils.createPopVlanAction(actionOrder++));
+
+        actions.add(ActionUtils.createOutputAction(outputPort, actionOrder));
+
+        FlowId flowId = new FlowId(getVlanFlowId(serviceName, inputPort, 0));
+      // return new FlowBuilder().setId(flowId).setKey(new FlowKey(flowId)).setTableId(FLOW_TABLE_ID)
+        return new FlowBuilder().setId(flowId).setTableId(FLOW_TABLE_ID)
+                .setPriority(EMPTY_VLAN_FLOW_PRIORITY)
+                .setMatch(MatchUtils.createWithoutVlanMatch(inputPort))
+                .setInstructions(ActionUtils.createInstructions(actions)).build();
+    }
+
+    /**
+     * @param servicePort servicePort port on which service is activated (format:
+     *        openflow:[node]:[port])
+     * @param interswitchLinks list of interswitch links for the node on which service is activated
+     * @param serviceName service name (used as prefix for flow IDs)
+     * @param queueNumber qos queue number
+     * @return list of flows
+     */
+    public static List<Flow> getFlows(String servicePort, List<Link> interswitchLinks,
+            String serviceName, long queueNumber) {
+        List<Flow> flows = new ArrayList<>();
+        flows.addAll(createPassingFlows(servicePort, serviceName, interswitchLinks));
+        flows.addAll(createIngressFlow(servicePort, serviceName, interswitchLinks));
+
+        return flows;
+    }
+
+    private static List<Flow> createIngressFlow(String outputPort, String serviceName,
+            List<Link> interswitchLinks) {
+        return interswitchLinks.stream().map(
+                link -> createIngressFlow(outputPort, link.getLinkId().getValue(), serviceName))
+                .collect(Collectors.toList());
+    }
+
+    public static Flow createIngressFlow(String outputPort, String inputPort, String serviceName) {
+        LOG.info(" inside createIngressFlow () outputPort{}, inputPort{} ", outputPort, inputPort);
+        List<Action> actions = new ArrayList<>();
+        int actionOrder = 0;
+
+        actions.add(ActionUtils.createOutputAction(inputPort, actionOrder));
+
+        FlowId flowId = new FlowId(getVlanFlowId(serviceName, outputPort, 0));
+        return new FlowBuilder().setId(flowId).setTableId(FLOW_TABLE_ID)
+                .setPriority(EMPTY_VLAN_FLOW_PRIORITY)
+                .setMatch(MatchUtils.createWithoutVlanMatch(outputPort))
+                .setInstructions(ActionUtils.createInstructions(actions)).build();
+    }
+
+    /**
+     * @param role differentiate coming endpoint is root or leaf
+     * @param flows object
+     * @param servicePort port on which service is activated (format: openflow:[node]:[port])
+     * @param internalVlanId VLAN ID used internally in OvSwitch network
+     * @param interswitchLinks list of interswitch links for the node on which service is activated
+     * @param serviceName service name (used as prefix for flow IDs)
+     * @param queueNumber qos queue number
+     * @param rootCount shows number of root
+     * @param eTreeUtils is utility object
+     * @param isExclusive show requested service is port or tag based
+     * @return list of flows
+     * @throws ResourceNotAvailableException if node is not augmented with FlowCapableNode class or
+     *         flow table is not present in node
+     * @throws TransactionCommitFailedException is raised and returned when transaction commit
+     *         failed
+     */
+    private static List<Flow> unTaggedFlows(String role, List<Flow> flows, String servicePort,
+            int internalVlanId, List<Link> interswitchLinks, String serviceName, long queueNumber,
+            long rootCount, EtreeUtils eTreeUtils, boolean isExclusive)
+            throws ResourceNotAvailableException {
+
+        if (role.equalsIgnoreCase(PortRole.ROOT.getName())) {
+            createRootFlows(flows, servicePort, internalVlanId, interswitchLinks, serviceName,
+                    queueNumber, rootCount, eTreeUtils);
+        } else {
+            createLeafFlows(flows, servicePort, internalVlanId, interswitchLinks, serviceName,
+                    queueNumber, eTreeUtils);
+        }
+
+        return flows;
+    }
+
+    /**
+     * @param flows object
+     * @param servicePort port on which service is activated (format: openflow:[node]:[port])
+     * @param internalVlanId VLAN ID used internally in OvSwitch network
+     * @param interswitchLinks list of interswitch links for the node on which service is activated
+     * @param serviceName service name (used as prefix for flow IDs)
+     * @param queueNumber qos queue number
+     * @param rootCount shows number of root
+     * @param eTreeUtils is utility object
+     * @throws ResourceNotAvailableException if node is not augmented with FlowCapableNode class or
+     *         flow table is not present in node
+     */
+    public static void createRootFlows(List<Flow> flows, String servicePort, int internalVlanId,
+            List<Link> interswitchLinks, String serviceName, long queueNumber, long rootCount,
+            EtreeUtils eTreeUtils)
+            throws ResourceNotAvailableException {
+        int[] rng = EtreeUtils.isAvailableVlan(internalVlanId);
+        Optional<Integer> externalVlanId;
+
+        for (int i = rng[0]; i <= rng[1]; i++) {
+            int epVlanID = eTreeUtils.getEpVlanID(serviceName, OVSConstant.CPETYPE);
+            externalVlanId = Optional.of(Integer.valueOf(epVlanID));
+
+            if (rootCount > 1) {
+                flows.addAll(createVlanPassingFlows(servicePort, i, externalVlanId, serviceName,
+                        interswitchLinks));
+                flows.addAll(createVlanPassingFlows(servicePort, epVlanID, externalVlanId,
+                        serviceName, interswitchLinks));
+                flows.add(createVlanIngressFlow(servicePort, epVlanID, externalVlanId, serviceName,
+                        interswitchLinks, queueNumber));
+            } else {
+                flows.addAll(createVlanPassingFlows(servicePort, i, externalVlanId, serviceName,
+                        interswitchLinks));
+                flows.add(createVlanIngressFlow(servicePort, epVlanID, externalVlanId, serviceName,
+                        interswitchLinks, queueNumber));
+            }
+        }
+
+        eTreeUtils.releaseEpTreeServiceVlan(serviceName);
+    }
+
+    /**
+     * @param flows object
+     * @param servicePort port on which service is activated (format: openflow:[node]:[port])
+     * @param internalVlanId VLAN ID used internally in OvSwitch network
+     * @param interswitchLinks list of interswitch links for the node on which service is activated
+     * @param serviceName service name (used as prefix for flow IDs)
+     * @param queueNumber qos queue number
+     * @param eTreeUtils is utility object
+     * @throws ResourceNotAvailableException if node is not augmented with FlowCapableNode class or
+     *         flow table is not present in node
+     * @return flows for leaf
+     */
+    public static List<Flow> createLeafFlows(List<Flow> flows, String servicePort,
+            int internalVlanId, List<Link> interswitchLinks, String serviceName, long queueNumber,
+            EtreeUtils eTreeUtils)
+            throws ResourceNotAvailableException {
+        Optional<Integer> externalVlanId;
+
+        for (int vlan =
+                OVSConstant.CPESTARTINCLUSIVE; vlan <= OVSConstant.CPEENDEXCLUSIVE; vlan++) {
+            externalVlanId = Optional.of(Integer.valueOf(vlan));
+            flows.addAll(createVlanPassingFlows(servicePort, vlan, externalVlanId, serviceName,
+                    interswitchLinks));
+            flows.add(createVlanIngressFlow(servicePort,
+                    eTreeUtils.getEpVlanID(serviceName, OVSConstant.SPETYPE), externalVlanId,
+                    serviceName, interswitchLinks, queueNumber));
+        }
+        eTreeUtils.releaseEpTreeServiceVlan(serviceName);
+
+        return flows;
+    }
+
     /**
      * Returns list of flows related to service named serviceName installed in specified flow table.
      *
@@ -222,7 +533,7 @@ public class OpenFlowUtils {
         }
         actions.add(ActionUtils.createOutputAction(outputPort, actionOrder));
 
-        FlowId flowId = new FlowId(getVlanFlowId(serviceName, inputPort));
+        FlowId flowId = new FlowId(getVlanFlowId(serviceName, inputPort, internalVlanId));
         return new FlowBuilder().setId(flowId)
                 .withKey(new FlowKey(flowId))
                 .setTableId(FLOW_TABLE_ID)
@@ -259,7 +570,7 @@ public class OpenFlowUtils {
                                 outputActionOrder + outputPortIds.indexOf(outputPortId)))
                     .collect(Collectors.toList()));
 
-        FlowId flowId = new FlowId(getVlanFlowId(serviceName, inputPort));
+        FlowId flowId = new FlowId(getVlanFlowId(serviceName, inputPort, internalVlanId));
         return new FlowBuilder().setId(flowId)
                     .withKey(new FlowKey(flowId))
                     .setTableId(FLOW_TABLE_ID)
@@ -271,7 +582,13 @@ public class OpenFlowUtils {
                     .build();
     }
 
-    private static String getVlanFlowId(String serviceName, String inputPort) {
-        return serviceName + "-" + FLOW_ID_MIDDLE_PART + "-" + inputPort;
+    private static String getVlanFlowId(String serviceName, String inputPort, int vlanId) {
+        if (vlanId != 0) {
+            return serviceName + "-" + FLOW_ID_MIDDLE_PART.concat(String.valueOf(vlanId)) + "-"
+                    + inputPort;
+        } else {
+            return serviceName + "-" + FLOW_ID_MIDDLE_PART + "-" + inputPort;
+        }
+
     }
 }
index 49062c2c0f4db6c01e693eb1f216160b98725f28..26c8752609a0ea488db05a40ef41e97651490588 100644 (file)
@@ -50,6 +50,7 @@ import org.opendaylight.yang.gen.v1.urn.mef.yang.nrp._interface.rev180321.NrpCon
 import org.opendaylight.yang.gen.v1.urn.mef.yang.nrp._interface.rev180321.nrp.connectivity.service.end.point.attrs.NrpCarrierEthConnectivityEndPointResource;
 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev180307.Uuid;
 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev180307.ConnectivityServiceEndPoint;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev180307.ServiceType;
 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev180307.connectivity.service.end.point.ServiceInterfacePoint;
 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev180307.OwnedNodeEdgePointRef;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.Table;
@@ -79,7 +80,7 @@ public class OvsActivatorTest extends AbstractConcurrentDataBrokerTest {
     private static final String nodeId = "ovs-node";
 
     private static final String interswitchName = "interswitch-openflow";
-    private static final String vlanName = "vlan-openflow";
+    private static final String vlanName = "vlan1-openflow";
     private static final String dropName = "default-DROP";
 
     List<String> of1InterwitchPorts = Arrays.asList("openflow:1:3", "openflow:1:4", "openflow:1:5");
@@ -108,7 +109,7 @@ public class OvsActivatorTest extends AbstractConcurrentDataBrokerTest {
 
         //when
         try {
-            ovsActivator.activate(endPoints,serviceId);
+            ovsActivator.activate(endPoints, serviceId, true, ServiceType.POINTTOPOINTCONNECTIVITY);
         } catch (ResourceNotAvailableException | InterruptedException | ExecutionException e) {
             fail(e.getMessage());
         }
@@ -121,7 +122,7 @@ public class OvsActivatorTest extends AbstractConcurrentDataBrokerTest {
 
         //when
         try {
-            ovsActivator.deactivate(endPoints, serviceId);
+            ovsActivator.deactivate(endPoints, serviceId, ServiceType.POINTTOPOINTCONNECTIVITY);
         } catch (ResourceNotAvailableException | InterruptedException | ExecutionException e) {
             fail(e.getMessage());
         }
index 1dd9dd9484462867ae6ae5a64b69e34ad53b826a..10178f9bcca8b499a58287b721977c41a8cd709e 100644 (file)
@@ -21,4 +21,4 @@
   
   <logger name="org.opendaylight.yangtools" level="INFO"/>
   <logger name="org.opendaylight.mdsal" level="INFO"/>
-</configuration>
\ No newline at end of file
+</configuration>
index 6e185a04b36bf6d1406b32d666ebbcc13027cf18..9fc3fa9b063dac31c03110f0bdb7a1ea01945371 100755 (executable)
 {
-       "variables": [],
-       "info": {
-               "name": "MEF LSO with Legato",
-               "_postman_id": "3acdc59d-3477-5fe5-66e6-388e2ea773db",
-               "description": "",
-               "schema": "https://schema.getpostman.com/json/collection/v2.0.0/collection.json"
-       },
-       "item": [
+       "id": "2a09e07a-31b1-2d00-58ca-97f6e6c30aa7",
+       "name": "MEF LSO with Legato",
+       "description": "",
+       "order": [
+               "d3ece99f-9a6f-294a-b334-9cd52e4539f8",
+               "35ba5643-dbba-bde3-030b-a0264d08c0b3",
+               "76715d27-331a-26b2-0b9a-fe13f906ce15",
+               "8f82b9b3-9e2d-0922-bba8-d4966348a1f9",
+               "b99ccfc0-15c9-824d-1f9f-cb7f88f1887a",
+               "9c64daa4-636b-480c-2398-c244da8872ad",
+               "38204090-64a6-970e-114d-37f9ffc6ecfd",
+               "fb9684fe-407b-3ba2-9860-e9c28ec8e1eb",
+               "077caa45-c44d-49fa-a633-531e7ec8087a",
+               "17a247fa-39ec-5d6f-e608-370d95c27fb2",
+               "1e13d8ec-0e5c-6120-3cc7-009a75b298d6",
+               "3f83f5e1-9139-30d1-8e86-db5df27da5d7",
+               "e1565740-4cf4-c225-0523-21c1529537aa",
+               "16ae3ac6-f710-0ec2-06be-427b6d12149e",
+               "e2649316-9827-88bd-ae66-2cbb42b845ec"
+       ],
+       "folders": [],
+       "folders_order": [],
+       "timestamp": 0,
+       "owner": 0,
+       "public": false,
+       "requests": [
                {
-                       "name": "Step 0 Init - add OVSDB Node",
-                       "request": {
-                               "url": "{{host}}/restconf/config/network-topology:network-topology/topology/ovsdb:1/",
-                               "method": "POST",
-                               "header": [
-                                       {
-                                               "key": "Content-Type",
-                                               "value": "application/json",
-                                               "description": ""
-                                       },
-                                       {
-                                               "key": "Authorization",
-                                               "value": "Basic YWRtaW46YWRtaW4=",
-                                               "description": ""
-                                       }
-                               ],
-                               "body": {
-                                       "mode": "raw",
-                                       "raw": "{\n    \"node\": [\n        {\n            \"node-id\": \"odl\",\n            \"connection-info\": {\n              \"remote-ip\": \"{{mininet_ip_address}}\",\n              \"remote-port\": 6640\n            }\n        }\n    ]\n}"
+                       "id": "077caa45-c44d-49fa-a633-531e7ec8087a",
+                       "headers": "Content-Type: application/json\nAuthorization: Basic YWRtaW46YWRtaW4=\n",
+                       "headerData": [
+                               {
+                                       "key": "Content-Type",
+                                       "value": "application/json",
+                                       "description": "",
+                                       "enabled": true
                                },
-                               "description": ""
-                       },
-                       "response": []
+                               {
+                                       "key": "Authorization",
+                                       "value": "Basic YWRtaW46YWRtaW4=",
+                                       "description": "",
+                                       "enabled": true
+                               }
+                       ],
+                       "url": "{{host}}/restconf/config/mef-legato-services:mef-services/carrier-ethernet/subscriber-services/evc/{{evc_id}}",
+                       "queryParams": [],
+                       "preRequestScript": null,
+                       "pathVariables": {},
+                       "pathVariableData": [],
+                       "method": "PUT",
+                       "data": [],
+                       "dataMode": "raw",
+                       "tests": null,
+                       "currentHelper": "normal",
+                       "helperAttributes": {},
+                       "time": 1563785297469,
+                       "name": "Step 2F - Create Ethernet Virtual Private Tree (EVPTREE) service",
+                       "description": "Create Ethernet Virtual Private Tree (EVPTREE) service ",
+                       "collectionId": "2a09e07a-31b1-2d00-58ca-97f6e6c30aa7",
+                       "responses": [],
+                       "rawModeData": "{\n    \"mef-legato-services:evc\": [\n      {\n        \"mef-legato-services:evc-id\": \"{{evc_id}}\",\n        \"mef-legato-services:cos-names\": {\n          \"mef-legato-services:cos-name\": [\n            {\n              \"mef-legato-services:name\": \"EVPTREE\"\n            }\n          ]\n        },\n        \"mef-legato-services:end-points\": {\n          \"mef-legato-services:end-point\": [\n            {\n              \"mef-legato-services:uni-id\": \"{{sip1_uuid}}\",\n              \"mef-legato-services:role\": \"root\",\n              \"mef-legato-services:admin-state\": \"true\",\n              \"mef-legato-services:color-identifier\": \"COLID1\",\n              \"mef-legato-services:cos-identifier\": \"COSID1\",\n              \"mef-legato-services:eec-identifier\": \"EECID1\",\n              \"mef-legato-services:source-mac-address-limit\": \"1\",\n              \"mef-legato-services:source-mac-address-limit-time-interval\": \"1\",\n              \"mef-legato-services:test-meg-enabled\": \"false\",\n              \"mef-legato-services:user-label\": \"admin\",\n              \"mef-legato-services:subscriber-meg-mip-enabled\": \"false\",\n              \"mef-legato-services:ce-vlans\": {\n                \"mef-legato-services:ce-vlan\": [\n                \t\t\"301\"\n            \t]\n              },\n              \"ingress-bwp-per-cos\": {\n                \"mef-legato-services:bwp-flow-per-cos\": [\n                  {\n                    \"mef-legato-services:cos-name\": \"Neon\",\n                    \"envelope-id\": \"Rank 0\",\n                    \"rank\": \"0\"\n                  }\n                ]\n              },\n              \"egress-bwp-per-eec\": {\n                \"mef-legato-services:bwp-flow-per-eec\": [\n                  {\n                    \"mef-legato-services:eec-name\": \"EEC-Krypton\",\n                    \"envelope-id\": \"Rank 0\",\n                    \"rank\": \"0\"\n                  }\n                ]\n              }\n            },\n\t\t\t{\n              \"mef-legato-services:uni-id\": \"{{sip2_uuid}}\",\n              \"mef-legato-services:role\": \"leaf\",\n              \"mef-legato-services:admin-state\": \"true\",\n              \"mef-legato-services:color-identifier\": \"COLID1\",\n              \"mef-legato-services:cos-identifier\": \"COSID1\",\n              \"mef-legato-services:eec-identifier\": \"EECID1\",\n              \"mef-legato-services:source-mac-address-limit\": \"1\",\n              \"mef-legato-services:source-mac-address-limit-time-interval\": \"1\",\n              \"mef-legato-services:test-meg-enabled\": \"false\",\n              \"mef-legato-services:user-label\": \"admin\",\n              \"mef-legato-services:subscriber-meg-mip-enabled\": \"false\",\n              \"mef-legato-services:ce-vlans\": {\n                \"mef-legato-services:ce-vlan\": [\n                \t\t\"301\"\n            \t]\n              },\n              \"ingress-bwp-per-cos\": {\n                \"mef-legato-services:bwp-flow-per-cos\": [\n                  {\n                    \"mef-legato-services:cos-name\": \"Neon\",\n                    \"envelope-id\": \"Rank 0\",\n                    \"rank\": \"0\"\n                  }\n                ]\n              },\n              \"egress-bwp-per-eec\": {\n                \"mef-legato-services:bwp-flow-per-eec\": [\n                  {\n                    \"mef-legato-services:eec-name\": \"EEC-Krypton\",\n                    \"envelope-id\": \"Rank 0\",\n                    \"rank\": \"0\"\n                  }\n                ]\n              }\n            },\n             {\n              \"mef-legato-services:uni-id\": \"{{sip3_uuid}}\",\n              \"mef-legato-services:role\": \"leaf\",\n              \"mef-legato-services:admin-state\": \"true\",\n              \"mef-legato-services:color-identifier\": \"COLID1\",\n              \"mef-legato-services:cos-identifier\": \"COSID1\",\n              \"mef-legato-services:eec-identifier\": \"EECID1\",\n              \"mef-legato-services:source-mac-address-limit\": \"1\",\n              \"mef-legato-services:source-mac-address-limit-time-interval\": \"1\",\n              \"mef-legato-services:test-meg-enabled\": \"false\",\n              \"mef-legato-services:user-label\": \"admin\",\n              \"mef-legato-services:subscriber-meg-mip-enabled\": \"false\",\n              \"mef-legato-services:ce-vlans\": {\n                \"mef-legato-services:ce-vlan\": [\n                \t\t\"301\"\n            \t]\n              },\n              \"ingress-bwp-per-cos\": {\n                \"mef-legato-services:bwp-flow-per-cos\": [\n                  {\n                    \"mef-legato-services:cos-name\": \"Neon\",\n                    \"envelope-id\": \"Rank 0\",\n                    \"rank\": \"0\"\n                  }\n                ]\n              },\n              \"egress-bwp-per-eec\": {\n                \"mef-legato-services:bwp-flow-per-eec\": [\n                  {\n                    \"mef-legato-services:eec-name\": \"EEC-Krypton\",\n                    \"envelope-id\": \"Rank 0\",\n                    \"rank\": \"0\"\n                  }\n                ]\n              }\n            }\n          ]\n        },\n        \"mef-legato-services:carrier-ethernet-sls\": {\n          \"mef-legato-services:sls-id\": \"SLSID1\",\n          \"mef-legato-services:start-time\": \"9372-84-27T31:46:58Z\",\n          \"mef-legato-services:cos-entries\": {\n            \"mef-legato-services:cos-entry\": [\n              {\n                \"mef-legato-services:cos-name\": \"Krypton\",\n                \"mef-legato-services:pm-entries\": {\n                  \"mef-legato-services:pm-entry\": [\n                    {\n                      \"mef-legato-services:pm-entry-id\": \"68\",\n                      \"mef-legato-services:sets-of-end-point-pairs\": {\n                        \"mef-legato-services:set-of-end-point-pairs\": [\n                          {\n                            \"mef-legato-services:index\": \"0\",\n                            \"sls-uni-exclusions\": {\n                              \"mef-legato-services:end-point-pair\": [\n                                {\n                                  \"mef-legato-services:end-point1\": \"1\",\n                                  \"mef-legato-services:end-point2\": \"2\"\n                                }\n                              ]\n                            }\n                          }\n                        ]\n                      },\n                      \"mef-legato-services:end-point-pairs\": {\n                        \"sls-uni-exclusions\": {\n                          \"mef-legato-services:end-point-pair\": [\n                            {\n                              \"mef-legato-services:end-point1\": \"1\",\n                              \"mef-legato-services:end-point2\": \"2\"\n                            }\n                          ]\n                        }\n                      }\n                    }\n                  ]\n                }\n              }\n            ]\n          }\n        },\n        \"mef-legato-services:connection-type\": \"rooted-multipoint\",\n        \"mef-legato-services:admin-state\": \"true\",\n        \"mef-legato-services:user-label\": \"U4\",\n        \"mef-legato-services:max-frame-size\": \"1522\",\n        \"mef-legato-services:max-num-of-evc-end-point\": \"2\",\n        \"mef-legato-services:ce-vlan-id-preservation\": \"false\",\n        \"mef-legato-services:ce-vlan-pcp-preservation\": \"false\",\n        \"mef-legato-services:ce-vlan-dei-preservation\": \"false\",\n        \"mef-legato-services:unicast-frame-delivery\": \"unconditional\",\n        \"mef-legato-services:multicast-frame-delivery\": \"unconditional\",\n        \"mef-legato-services:broadcast-frame-delivery\": \"unconditional\",\n        \"mef-legato-services:svc-type\": \"evptree\"\n      }\n    ]  \n}  \n"
                },
                {
-                       "name": "Step 1 change statistics manager mode - disable",
-                       "request": {
-                               "url": "{{host}}/restconf/operations/statistics-manager-control:change-statistics-work-mode",
-                               "method": "POST",
-                               "header": [
-                                       {
-                                               "key": "Content-Type",
-                                               "value": "application/json",
-                                               "description": ""
-                                       },
-                                       {
-                                               "key": "Authorization",
-                                               "value": "Basic YWRtaW46YWRtaW4=",
-                                               "description": ""
-                                       }
-                               ],
-                               "body": {
-                                       "mode": "raw",
-                                       "raw": "{\n  \"input\": {\n    \"mode\": \"FULLY_DISABLED\"\n  }\n}"
+                       "id": "16ae3ac6-f710-0ec2-06be-427b6d12149e",
+                       "name": "del OVSDB Node",
+                       "description": "",
+                       "collectionId": "2a09e07a-31b1-2d00-58ca-97f6e6c30aa7",
+                       "method": "DELETE",
+                       "headers": "Content-Type: application/json\nAuthorization: Basic YWRtaW46YWRtaW4=",
+                       "dataMode": "raw",
+                       "data": [],
+                       "rawModeData": "",
+                       "url": "{{host}}/restconf/config/network-topology:network-topology/topology/ovsdb%3A1/node/odl",
+                       "responses": [],
+                       "pathVariableData": [],
+                       "queryParams": [],
+                       "headerData": [
+                               {
+                                       "key": "Content-Type",
+                                       "value": "application/json",
+                                       "description": ""
                                },
-                               "description": ""
-                       },
-                       "response": []
+                               {
+                                       "key": "Authorization",
+                                       "value": "Basic YWRtaW46YWRtaW4=",
+                                       "description": ""
+                               }
+                       ],
+                       "collection_id": "2a09e07a-31b1-2d00-58ca-97f6e6c30aa7"
                },
                {
-                       "name": "Step 1a - get Tapi Topology - mef:presto-nrp-topology",
-                       "request": {
-                               "url": "{{host}}/restconf/operational/tapi-common:context/tapi-topology:topology/mef:presto-nrp-topology",
-                               "method": "GET",
-                               "header": [
-                                       {
-                                               "key": "Authorization",
-                                               "value": "Basic YWRtaW46YWRtaW4=",
-                                               "description": ""
-                                       }
-                               ],
-                               "body": {
-                                       "mode": "raw",
-                                       "raw": ""
+                       "id": "17a247fa-39ec-5d6f-e608-370d95c27fb2",
+                       "name": "Step 3 A - Get connnectivity service list - Presto",
+                       "description": "",
+                       "collectionId": "2a09e07a-31b1-2d00-58ca-97f6e6c30aa7",
+                       "method": "POST",
+                       "headers": "Content-Type: application/json\nAuthorization: Basic YWRtaW46YWRtaW4=",
+                       "dataMode": "raw",
+                       "data": [],
+                       "rawModeData": "",
+                       "url": "{{host}}/restconf/operations/tapi-connectivity:get-connectivity-service-list",
+                       "responses": [],
+                       "pathVariableData": [],
+                       "queryParams": [],
+                       "headerData": [
+                               {
+                                       "key": "Content-Type",
+                                       "value": "application/json",
+                                       "description": ""
                                },
-                               "description": ""
-                       },
-                       "response": []
+                               {
+                                       "key": "Authorization",
+                                       "value": "Basic YWRtaW46YWRtaW4=",
+                                       "description": ""
+                               }
+                       ],
+                       "collection_id": "2a09e07a-31b1-2d00-58ca-97f6e6c30aa7"
                },
                {
-                       "name": "Step 2 - Create POINT to POINT EVC using PUT method",
-                       "request": {
-                               "url": "{{host}}/restconf/config/mef-legato-services:mef-services/carrier-ethernet/subscriber-services/evc/{{evc_id}}",
-                               "method": "PUT",
-                               "header": [
-                                       {
-                                               "key": "Content-Type",
-                                               "value": "application/json",
-                                               "description": ""
-                                       },
-                                       {
-                                               "key": "Authorization",
-                                               "value": "Basic YWRtaW46YWRtaW4=",
-                                               "description": ""
-                                       }
-                               ],
-                               "body": {
-                                       "mode": "raw",
-                                       "raw": "{\n    \"mef-legato-services:evc\": [\n      {\n        \"mef-legato-services:evc-id\": \"{{evc_id}}\",\n        \"mef-legato-services:cos-names\": {\n          \"mef-legato-services:cos-name\": [\n            {\n              \"mef-legato-services:name\": \"EVPL\"\n            }\n          ]\n        },\n        \"mef-legato-services:end-points\": {\n          \"mef-legato-services:end-point\": [\n            {\n              \"mef-legato-services:uni-id\": \"{{sip1_uuid}}\",\n              \"mef-legato-services:role\": \"root\",\n              \"mef-legato-services:admin-state\": \"true\",\n              \"mef-legato-services:color-identifier\": \"COLID1\",\n              \"mef-legato-services:cos-identifier\": \"COSID1\",\n              \"mef-legato-services:eec-identifier\": \"EECID1\",\n              \"mef-legato-services:source-mac-address-limit\": \"1\",\n              \"mef-legato-services:source-mac-address-limit-time-interval\": \"1\",\n              \"mef-legato-services:test-meg-enabled\": \"false\",\n              \"mef-legato-services:user-label\": \"admin\",\n              \"mef-legato-services:subscriber-meg-mip-enabled\": \"false\",\n              \"mef-legato-services:ce-vlans\": {\n                \"mef-legato-services:ce-vlan\": [\n                \t\t\"301\"\n            \t]\n              },\n              \"ingress-bwp-per-cos\": {\n                \"mef-legato-services:bwp-flow-per-cos\": [\n                  {\n                    \"mef-legato-services:cos-name\": \"Neon\",\n                    \"envelope-id\": \"Rank 0\",\n                    \"rank\": \"0\"\n                  }\n                ]\n              },\n              \"egress-bwp-per-eec\": {\n                \"mef-legato-services:bwp-flow-per-eec\": [\n                  {\n                    \"mef-legato-services:eec-name\": \"EEC-Krypton\",\n                    \"envelope-id\": \"Rank 0\",\n                    \"rank\": \"0\"\n                  }\n                ]\n              }\n            },\n\t\t\t{\n              \"mef-legato-services:uni-id\": \"{{sip2_uuid}}\",\n              \"mef-legato-services:role\": \"root\",\n              \"mef-legato-services:admin-state\": \"true\",\n              \"mef-legato-services:color-identifier\": \"COLID1\",\n              \"mef-legato-services:cos-identifier\": \"COSID1\",\n              \"mef-legato-services:eec-identifier\": \"EECID1\",\n              \"mef-legato-services:source-mac-address-limit\": \"1\",\n              \"mef-legato-services:source-mac-address-limit-time-interval\": \"1\",\n              \"mef-legato-services:test-meg-enabled\": \"false\",\n              \"mef-legato-services:user-label\": \"admin\",\n              \"mef-legato-services:subscriber-meg-mip-enabled\": \"false\",\n              \"mef-legato-services:ce-vlans\": {\n                \"mef-legato-services:ce-vlan\": [\n                \t\t\"301\"\n            \t]\n              },\n              \"ingress-bwp-per-cos\": {\n                \"mef-legato-services:bwp-flow-per-cos\": [\n                  {\n                    \"mef-legato-services:cos-name\": \"Neon\",\n                    \"envelope-id\": \"Rank 0\",\n                    \"rank\": \"0\"\n                  }\n                ]\n              },\n              \"egress-bwp-per-eec\": {\n                \"mef-legato-services:bwp-flow-per-eec\": [\n                  {\n                    \"mef-legato-services:eec-name\": \"EEC-Krypton\",\n                    \"envelope-id\": \"Rank 0\",\n                    \"rank\": \"0\"\n                  }\n                ]\n              }\n            }\n          ]\n        },\n        \"mef-legato-services:carrier-ethernet-sls\": {\n          \"mef-legato-services:sls-id\": \"SLSID1\",\n          \"mef-legato-services:start-time\": \"9372-84-27T31:46:58Z\",\n          \"mef-legato-services:cos-entries\": {\n            \"mef-legato-services:cos-entry\": [\n              {\n                \"mef-legato-services:cos-name\": \"Krypton\",\n                \"mef-legato-services:pm-entries\": {\n                  \"mef-legato-services:pm-entry\": [\n                    {\n                      \"mef-legato-services:pm-entry-id\": \"68\",\n                      \"mef-legato-services:sets-of-end-point-pairs\": {\n                        \"mef-legato-services:set-of-end-point-pairs\": [\n                          {\n                            \"mef-legato-services:index\": \"0\",\n                            \"sls-uni-exclusions\": {\n                              \"mef-legato-services:end-point-pair\": [\n                                {\n                                  \"mef-legato-services:end-point1\": \"1\",\n                                  \"mef-legato-services:end-point2\": \"2\"\n                                }\n                              ]\n                            }\n                          }\n                        ]\n                      },\n                      \"mef-legato-services:end-point-pairs\": {\n                        \"sls-uni-exclusions\": {\n                          \"mef-legato-services:end-point-pair\": [\n                            {\n                              \"mef-legato-services:end-point1\": \"1\",\n                              \"mef-legato-services:end-point2\": \"2\"\n                            }\n                          ]\n                        }\n                      }\n                    }\n                  ]\n                }\n              }\n            ]\n          }\n        },\n        \"mef-legato-services:connection-type\": \"point-to-point\",\n        \"mef-legato-services:admin-state\": \"true\",\n        \"mef-legato-services:user-label\": \"U4\",\n        \"mef-legato-services:max-frame-size\": \"1522\",\n        \"mef-legato-services:max-num-of-evc-end-point\": \"2\",\n        \"mef-legato-services:ce-vlan-id-preservation\": \"false\",\n        \"mef-legato-services:ce-vlan-pcp-preservation\": \"false\",\n        \"mef-legato-services:ce-vlan-dei-preservation\": \"false\",\n        \"mef-legato-services:unicast-frame-delivery\": \"unconditional\",\n        \"mef-legato-services:multicast-frame-delivery\": \"unconditional\",\n        \"mef-legato-services:broadcast-frame-delivery\": \"unconditional\",\n        \"mef-legato-services:svc-type\": \"epl\"\n      }\n    ]  \n}  \n"
+                       "id": "1e13d8ec-0e5c-6120-3cc7-009a75b298d6",
+                       "name": "Step 3 B - Get list of EVC - Config API",
+                       "description": "",
+                       "collectionId": "2a09e07a-31b1-2d00-58ca-97f6e6c30aa7",
+                       "method": "GET",
+                       "headers": "Content-Type: application/json\nAuthorization: Basic YWRtaW46YWRtaW4=",
+                       "dataMode": "raw",
+                       "data": [],
+                       "rawModeData": "",
+                       "url": "{{host}}/restconf/config/mef-legato-services:mef-services/carrier-ethernet/subscriber-services/",
+                       "responses": [],
+                       "pathVariableData": [],
+                       "queryParams": [],
+                       "headerData": [
+                               {
+                                       "key": "Content-Type",
+                                       "value": "application/json",
+                                       "description": ""
                                },
-                               "description": ""
-                       },
-                       "response": []
+                               {
+                                       "key": "Authorization",
+                                       "value": "Basic YWRtaW46YWRtaW4=",
+                                       "description": ""
+                               }
+                       ],
+                       "collection_id": "2a09e07a-31b1-2d00-58ca-97f6e6c30aa7"
                },
                {
-                       "name": "Step 2 - Create MULTIPOINT to MULTIPOINT EVC using PUT method",
-                       "request": {
-                               "url": "{{host}}/restconf/config/mef-legato-services:mef-services/carrier-ethernet/subscriber-services/evc/{{evc_id}}",
-                               "method": "PUT",
-                               "header": [
-                                       {
-                                               "key": "Content-Type",
-                                               "value": "application/json",
-                                               "description": ""
-                                       },
-                                       {
-                                               "key": "Authorization",
-                                               "value": "Basic YWRtaW46YWRtaW4=",
-                                               "description": ""
-                                       }
-                               ],
-                               "body": {
-                                       "mode": "raw",
-                                       "raw": "{\n    \"mef-legato-services:evc\": [\n      {\n        \"mef-legato-services:evc-id\": \"{{evc_id}}\",\n        \"mef-legato-services:cos-names\": {\n          \"mef-legato-services:cos-name\": [\n            {\n              \"mef-legato-services:name\": \"EVPL\"\n            }\n          ]\n        },\n        \"mef-legato-services:end-points\": {\n          \"mef-legato-services:end-point\": [\n            {\n              \"mef-legato-services:uni-id\": \"{{sip1_uuid}}\",\n              \"mef-legato-services:role\": \"root\",\n              \"mef-legato-services:admin-state\": \"true\",\n              \"mef-legato-services:color-identifier\": \"COLID1\",\n              \"mef-legato-services:cos-identifier\": \"COSID1\",\n              \"mef-legato-services:eec-identifier\": \"EECID1\",\n              \"mef-legato-services:source-mac-address-limit\": \"1\",\n              \"mef-legato-services:source-mac-address-limit-time-interval\": \"1\",\n              \"mef-legato-services:test-meg-enabled\": \"false\",\n              \"mef-legato-services:user-label\": \"admin\",\n              \"mef-legato-services:subscriber-meg-mip-enabled\": \"false\",\n              \"mef-legato-services:ce-vlans\": {\n                \"mef-legato-services:ce-vlan\": [\n                \t\t\"301\"\n            \t]\n              },\n              \"ingress-bwp-per-cos\": {\n                \"mef-legato-services:bwp-flow-per-cos\": [\n                  {\n                    \"mef-legato-services:cos-name\": \"Neon\",\n                    \"envelope-id\": \"Rank 0\",\n                    \"rank\": \"0\"\n                  }\n                ]\n              },\n              \"egress-bwp-per-eec\": {\n                \"mef-legato-services:bwp-flow-per-eec\": [\n                  {\n                    \"mef-legato-services:eec-name\": \"EEC-Krypton\",\n                    \"envelope-id\": \"Rank 0\",\n                    \"rank\": \"0\"\n                  }\n                ]\n              }\n            },\n\t\t\t{\n              \"mef-legato-services:uni-id\": \"{{sip2_uuid}}\",\n              \"mef-legato-services:role\": \"root\",\n              \"mef-legato-services:admin-state\": \"true\",\n              \"mef-legato-services:color-identifier\": \"COLID1\",\n              \"mef-legato-services:cos-identifier\": \"COSID1\",\n              \"mef-legato-services:eec-identifier\": \"EECID1\",\n              \"mef-legato-services:source-mac-address-limit\": \"1\",\n              \"mef-legato-services:source-mac-address-limit-time-interval\": \"1\",\n              \"mef-legato-services:test-meg-enabled\": \"false\",\n              \"mef-legato-services:user-label\": \"admin\",\n              \"mef-legato-services:subscriber-meg-mip-enabled\": \"false\",\n              \"mef-legato-services:ce-vlans\": {\n                \"mef-legato-services:ce-vlan\": [\n                \t\t\"301\"\n            \t]\n              },\n              \"ingress-bwp-per-cos\": {\n                \"mef-legato-services:bwp-flow-per-cos\": [\n                  {\n                    \"mef-legato-services:cos-name\": \"Neon\",\n                    \"envelope-id\": \"Rank 0\",\n                    \"rank\": \"0\"\n                  }\n                ]\n              },\n              \"egress-bwp-per-eec\": {\n                \"mef-legato-services:bwp-flow-per-eec\": [\n                  {\n                    \"mef-legato-services:eec-name\": \"EEC-Krypton\",\n                    \"envelope-id\": \"Rank 0\",\n                    \"rank\": \"0\"\n                  }\n                ]\n              }\n            },\n             {\n              \"mef-legato-services:uni-id\": \"{{sip3_uuid}}\",\n              \"mef-legato-services:role\": \"root\",\n              \"mef-legato-services:admin-state\": \"true\",\n              \"mef-legato-services:color-identifier\": \"COLID1\",\n              \"mef-legato-services:cos-identifier\": \"COSID1\",\n              \"mef-legato-services:eec-identifier\": \"EECID1\",\n              \"mef-legato-services:source-mac-address-limit\": \"1\",\n              \"mef-legato-services:source-mac-address-limit-time-interval\": \"1\",\n              \"mef-legato-services:test-meg-enabled\": \"false\",\n              \"mef-legato-services:user-label\": \"admin\",\n              \"mef-legato-services:subscriber-meg-mip-enabled\": \"false\",\n              \"mef-legato-services:ce-vlans\": {\n                \"mef-legato-services:ce-vlan\": [\n                \t\t\"301\"\n            \t]\n              },\n              \"ingress-bwp-per-cos\": {\n                \"mef-legato-services:bwp-flow-per-cos\": [\n                  {\n                    \"mef-legato-services:cos-name\": \"Neon\",\n                    \"envelope-id\": \"Rank 0\",\n                    \"rank\": \"0\"\n                  }\n                ]\n              },\n              \"egress-bwp-per-eec\": {\n                \"mef-legato-services:bwp-flow-per-eec\": [\n                  {\n                    \"mef-legato-services:eec-name\": \"EEC-Krypton\",\n                    \"envelope-id\": \"Rank 0\",\n                    \"rank\": \"0\"\n                  }\n                ]\n              }\n            }\n          ]\n        },\n        \"mef-legato-services:carrier-ethernet-sls\": {\n          \"mef-legato-services:sls-id\": \"SLSID1\",\n          \"mef-legato-services:start-time\": \"9372-84-27T31:46:58Z\",\n          \"mef-legato-services:cos-entries\": {\n            \"mef-legato-services:cos-entry\": [\n              {\n                \"mef-legato-services:cos-name\": \"Krypton\",\n                \"mef-legato-services:pm-entries\": {\n                  \"mef-legato-services:pm-entry\": [\n                    {\n                      \"mef-legato-services:pm-entry-id\": \"68\",\n                      \"mef-legato-services:sets-of-end-point-pairs\": {\n                        \"mef-legato-services:set-of-end-point-pairs\": [\n                          {\n                            \"mef-legato-services:index\": \"0\",\n                            \"sls-uni-exclusions\": {\n                              \"mef-legato-services:end-point-pair\": [\n                                {\n                                  \"mef-legato-services:end-point1\": \"1\",\n                                  \"mef-legato-services:end-point2\": \"2\"\n                                }\n                              ]\n                            }\n                          }\n                        ]\n                      },\n                      \"mef-legato-services:end-point-pairs\": {\n                        \"sls-uni-exclusions\": {\n                          \"mef-legato-services:end-point-pair\": [\n                            {\n                              \"mef-legato-services:end-point1\": \"1\",\n                              \"mef-legato-services:end-point2\": \"2\"\n                            }\n                          ]\n                        }\n                      }\n                    }\n                  ]\n                }\n              }\n            ]\n          }\n        },\n        \"mef-legato-services:connection-type\": \"multipoint-to-multipoint\",\n        \"mef-legato-services:admin-state\": \"true\",\n        \"mef-legato-services:user-label\": \"U4\",\n        \"mef-legato-services:max-frame-size\": \"1522\",\n        \"mef-legato-services:max-num-of-evc-end-point\": \"2\",\n        \"mef-legato-services:ce-vlan-id-preservation\": \"false\",\n        \"mef-legato-services:ce-vlan-pcp-preservation\": \"false\",\n        \"mef-legato-services:ce-vlan-dei-preservation\": \"false\",\n        \"mef-legato-services:unicast-frame-delivery\": \"unconditional\",\n        \"mef-legato-services:multicast-frame-delivery\": \"unconditional\",\n        \"mef-legato-services:broadcast-frame-delivery\": \"unconditional\",\n        \"mef-legato-services:svc-type\": \"eplan\"\n      }\n    ]  \n}  \n"
+                       "id": "35ba5643-dbba-bde3-030b-a0264d08c0b3",
+                       "name": "Step 1 change statistics manager mode - disable",
+                       "description": "",
+                       "collectionId": "2a09e07a-31b1-2d00-58ca-97f6e6c30aa7",
+                       "method": "POST",
+                       "headers": "Content-Type: application/json\nAuthorization: Basic YWRtaW46YWRtaW4=",
+                       "dataMode": "raw",
+                       "data": [],
+                       "rawModeData": "{\n  \"input\": {\n    \"mode\": \"FULLY_DISABLED\"\n  }\n}",
+                       "url": "{{host}}/restconf/operations/statistics-manager-control:change-statistics-work-mode",
+                       "responses": [],
+                       "pathVariableData": [],
+                       "queryParams": [],
+                       "headerData": [
+                               {
+                                       "key": "Content-Type",
+                                       "value": "application/json",
+                                       "description": ""
                                },
-                               "description": ""
-                       },
-                       "response": []
+                               {
+                                       "key": "Authorization",
+                                       "value": "Basic YWRtaW46YWRtaW4=",
+                                       "description": ""
+                               }
+                       ],
+                       "collection_id": "2a09e07a-31b1-2d00-58ca-97f6e6c30aa7"
                },
                {
-                       "name": "Step 2 - Create POINT to POINT EVC using POST  method",
-                       "request": {
-                               "url": "{{host}}/restconf/config/mef-legato-services:mef-services/carrier-ethernet/subscriber-services",
-                               "method": "POST",
-                               "header": [
-                                       {
-                                               "key": "Content-Type",
-                                               "value": "application/json",
-                                               "description": ""
-                                       },
-                                       {
-                                               "key": "Authorization",
-                                               "value": "Basic YWRtaW46YWRtaW4=",
-                                               "description": ""
-                                       }
-                               ],
-                               "body": {
-                                       "mode": "raw",
-                                       "raw": "{\n    \"mef-legato-services:evc\": [\n      {\n        \"mef-legato-services:evc-id\": \"{{evc_id}}\",\n        \"mef-legato-services:cos-names\": {\n          \"mef-legato-services:cos-name\": [\n            {\n              \"mef-legato-services:name\": \"EVPL\"\n            }\n          ]\n        },\n        \"mef-legato-services:end-points\": {\n          \"mef-legato-services:end-point\": [\n            {\n              \"mef-legato-services:uni-id\": \"{{sip1_uuid}}\",\n              \"mef-legato-services:role\": \"root\",\n              \"mef-legato-services:admin-state\": \"true\",\n              \"mef-legato-services:color-identifier\": \"COLID1\",\n              \"mef-legato-services:cos-identifier\": \"COSID1\",\n              \"mef-legato-services:eec-identifier\": \"EECID1\",\n              \"mef-legato-services:source-mac-address-limit\": \"1\",\n              \"mef-legato-services:source-mac-address-limit-time-interval\": \"1\",\n              \"mef-legato-services:test-meg-enabled\": \"false\",\n              \"mef-legato-services:user-label\": \"admin\",\n              \"mef-legato-services:subscriber-meg-mip-enabled\": \"false\",\n              \"mef-legato-services:ce-vlans\": {\n                \"mef-legato-services:ce-vlan\": [\n                \t\t\"301\"\n            \t]\n              },\n              \"ingress-bwp-per-cos\": {\n                \"mef-legato-services:bwp-flow-per-cos\": [\n                  {\n                    \"mef-legato-services:cos-name\": \"Neon\",\n                    \"envelope-id\": \"Rank 0\",\n                    \"rank\": \"0\"\n                  }\n                ]\n              },\n              \"egress-bwp-per-eec\": {\n                \"mef-legato-services:bwp-flow-per-eec\": [\n                  {\n                    \"mef-legato-services:eec-name\": \"EEC-Krypton\",\n                    \"envelope-id\": \"Rank 0\",\n                    \"rank\": \"0\"\n                  }\n                ]\n              }\n            },\n\t\t\t{\n              \"mef-legato-services:uni-id\": \"{{sip2_uuid}}\",\n              \"mef-legato-services:role\": \"root\",\n              \"mef-legato-services:admin-state\": \"true\",\n              \"mef-legato-services:color-identifier\": \"COLID1\",\n              \"mef-legato-services:cos-identifier\": \"COSID1\",\n              \"mef-legato-services:eec-identifier\": \"EECID1\",\n              \"mef-legato-services:source-mac-address-limit\": \"1\",\n              \"mef-legato-services:source-mac-address-limit-time-interval\": \"1\",\n              \"mef-legato-services:test-meg-enabled\": \"false\",\n              \"mef-legato-services:user-label\": \"admin\",\n              \"mef-legato-services:subscriber-meg-mip-enabled\": \"false\",\n              \"mef-legato-services:ce-vlans\": {\n                \"mef-legato-services:ce-vlan\": [\n                \t\t\"301\"\n            \t]\n              },\n              \"ingress-bwp-per-cos\": {\n                \"mef-legato-services:bwp-flow-per-cos\": [\n                  {\n                    \"mef-legato-services:cos-name\": \"Neon\",\n                    \"envelope-id\": \"Rank 0\",\n                    \"rank\": \"0\"\n                  }\n                ]\n              },\n              \"egress-bwp-per-eec\": {\n                \"mef-legato-services:bwp-flow-per-eec\": [\n                  {\n                    \"mef-legato-services:eec-name\": \"EEC-Krypton\",\n                    \"envelope-id\": \"Rank 0\",\n                    \"rank\": \"0\"\n                  }\n                ]\n              }\n            }\n          ]\n        },\n        \"mef-legato-services:carrier-ethernet-sls\": {\n          \"mef-legato-services:sls-id\": \"SLSID1\",\n          \"mef-legato-services:start-time\": \"9372-84-27T31:46:58Z\",\n          \"mef-legato-services:cos-entries\": {\n            \"mef-legato-services:cos-entry\": [\n              {\n                \"mef-legato-services:cos-name\": \"Krypton\",\n                \"mef-legato-services:pm-entries\": {\n                  \"mef-legato-services:pm-entry\": [\n                    {\n                      \"mef-legato-services:pm-entry-id\": \"68\",\n                      \"mef-legato-services:sets-of-end-point-pairs\": {\n                        \"mef-legato-services:set-of-end-point-pairs\": [\n                          {\n                            \"mef-legato-services:index\": \"0\",\n                            \"sls-uni-exclusions\": {\n                              \"mef-legato-services:end-point-pair\": [\n                                {\n                                  \"mef-legato-services:end-point1\": \"1\",\n                                  \"mef-legato-services:end-point2\": \"2\"\n                                }\n                              ]\n                            }\n                          }\n                        ]\n                      },\n                      \"mef-legato-services:end-point-pairs\": {\n                        \"sls-uni-exclusions\": {\n                          \"mef-legato-services:end-point-pair\": [\n                            {\n                              \"mef-legato-services:end-point1\": \"1\",\n                              \"mef-legato-services:end-point2\": \"2\"\n                            }\n                          ]\n                        }\n                      }\n                    }\n                  ]\n                }\n              }\n            ]\n          }\n        },\n        \"mef-legato-services:connection-type\": \"point-to-point\",\n        \"mef-legato-services:admin-state\": \"true\",\n        \"mef-legato-services:user-label\": \"U4\",\n        \"mef-legato-services:max-frame-size\": \"1522\",\n        \"mef-legato-services:max-num-of-evc-end-point\": \"2\",\n        \"mef-legato-services:ce-vlan-id-preservation\": \"false\",\n        \"mef-legato-services:ce-vlan-pcp-preservation\": \"false\",\n        \"mef-legato-services:ce-vlan-dei-preservation\": \"false\",\n        \"mef-legato-services:unicast-frame-delivery\": \"unconditional\",\n        \"mef-legato-services:multicast-frame-delivery\": \"unconditional\",\n        \"mef-legato-services:broadcast-frame-delivery\": \"unconditional\",\n        \"mef-legato-services:svc-type\": \"epl\"\n      }\n    ]  \n}  \n"
+                       "id": "38204090-64a6-970e-114d-37f9ffc6ecfd",
+                       "headers": "Content-Type: application/json\nAuthorization: Basic YWRtaW46YWRtaW4=\n",
+                       "headerData": [
+                               {
+                                       "key": "Content-Type",
+                                       "value": "application/json",
+                                       "description": "",
+                                       "enabled": true
                                },
-                               "description": ""
-                       },
-                       "response": []
+                               {
+                                       "key": "Authorization",
+                                       "value": "Basic YWRtaW46YWRtaW4=",
+                                       "description": "",
+                                       "enabled": true
+                               }
+                       ],
+                       "url": "{{host}}/restconf/config/mef-legato-services:mef-services/carrier-ethernet/subscriber-services/evc/{{evc_id}}",
+                       "queryParams": [],
+                       "preRequestScript": null,
+                       "pathVariables": {},
+                       "pathVariableData": [],
+                       "method": "PUT",
+                       "data": [],
+                       "dataMode": "raw",
+                       "tests": null,
+                       "currentHelper": "normal",
+                       "helperAttributes": {},
+                       "time": 1563779414626,
+                       "name": "Step 2D - Create Ethernet Virtual Private LAN (EVPLAN) Service",
+                       "description": "Create Ethernet Vritual Private LAN (EVPLAN) Service",
+                       "collectionId": "2a09e07a-31b1-2d00-58ca-97f6e6c30aa7",
+                       "responses": [],
+                       "rawModeData": "{\n    \"mef-legato-services:evc\": [\n      {\n        \"mef-legato-services:evc-id\": \"{{evc_id}}\",\n        \"mef-legato-services:cos-names\": {\n          \"mef-legato-services:cos-name\": [\n            {\n              \"mef-legato-services:name\": \"EVPLAN\"\n            }\n          ]\n        },\n        \"mef-legato-services:end-points\": {\n          \"mef-legato-services:end-point\": [\n            {\n              \"mef-legato-services:uni-id\": \"{{sip1_uuid}}\",\n              \"mef-legato-services:role\": \"root\",\n              \"mef-legato-services:admin-state\": \"true\",\n              \"mef-legato-services:color-identifier\": \"COLID1\",\n              \"mef-legato-services:cos-identifier\": \"COSID1\",\n              \"mef-legato-services:eec-identifier\": \"EECID1\",\n              \"mef-legato-services:source-mac-address-limit\": \"1\",\n              \"mef-legato-services:source-mac-address-limit-time-interval\": \"1\",\n              \"mef-legato-services:test-meg-enabled\": \"false\",\n              \"mef-legato-services:user-label\": \"admin\",\n              \"mef-legato-services:subscriber-meg-mip-enabled\": \"false\",\n              \"mef-legato-services:ce-vlans\": {\n                \"mef-legato-services:ce-vlan\": [\n                \t\t\"301\"\n            \t]\n              },\n              \"ingress-bwp-per-cos\": {\n                \"mef-legato-services:bwp-flow-per-cos\": [\n                  {\n                    \"mef-legato-services:cos-name\": \"Neon\",\n                    \"envelope-id\": \"Rank 0\",\n                    \"rank\": \"0\"\n                  }\n                ]\n              },\n              \"egress-bwp-per-eec\": {\n                \"mef-legato-services:bwp-flow-per-eec\": [\n                  {\n                    \"mef-legato-services:eec-name\": \"EEC-Krypton\",\n                    \"envelope-id\": \"Rank 0\",\n                    \"rank\": \"0\"\n                  }\n                ]\n              }\n            },\n\t\t\t{\n              \"mef-legato-services:uni-id\": \"{{sip2_uuid}}\",\n              \"mef-legato-services:role\": \"root\",\n              \"mef-legato-services:admin-state\": \"true\",\n              \"mef-legato-services:color-identifier\": \"COLID1\",\n              \"mef-legato-services:cos-identifier\": \"COSID1\",\n              \"mef-legato-services:eec-identifier\": \"EECID1\",\n              \"mef-legato-services:source-mac-address-limit\": \"1\",\n              \"mef-legato-services:source-mac-address-limit-time-interval\": \"1\",\n              \"mef-legato-services:test-meg-enabled\": \"false\",\n              \"mef-legato-services:user-label\": \"admin\",\n              \"mef-legato-services:subscriber-meg-mip-enabled\": \"false\",\n              \"mef-legato-services:ce-vlans\": {\n                \"mef-legato-services:ce-vlan\": [\n                \t\t\"301\"\n            \t]\n              },\n              \"ingress-bwp-per-cos\": {\n                \"mef-legato-services:bwp-flow-per-cos\": [\n                  {\n                    \"mef-legato-services:cos-name\": \"Neon\",\n                    \"envelope-id\": \"Rank 0\",\n                    \"rank\": \"0\"\n                  }\n                ]\n              },\n              \"egress-bwp-per-eec\": {\n                \"mef-legato-services:bwp-flow-per-eec\": [\n                  {\n                    \"mef-legato-services:eec-name\": \"EEC-Krypton\",\n                    \"envelope-id\": \"Rank 0\",\n                    \"rank\": \"0\"\n                  }\n                ]\n              }\n            },\n             {\n              \"mef-legato-services:uni-id\": \"{{sip3_uuid}}\",\n              \"mef-legato-services:role\": \"root\",\n              \"mef-legato-services:admin-state\": \"true\",\n              \"mef-legato-services:color-identifier\": \"COLID1\",\n              \"mef-legato-services:cos-identifier\": \"COSID1\",\n              \"mef-legato-services:eec-identifier\": \"EECID1\",\n              \"mef-legato-services:source-mac-address-limit\": \"1\",\n              \"mef-legato-services:source-mac-address-limit-time-interval\": \"1\",\n              \"mef-legato-services:test-meg-enabled\": \"false\",\n              \"mef-legato-services:user-label\": \"admin\",\n              \"mef-legato-services:subscriber-meg-mip-enabled\": \"false\",\n              \"mef-legato-services:ce-vlans\": {\n                \"mef-legato-services:ce-vlan\": [\n                \t\t\"301\"\n            \t]\n              },\n              \"ingress-bwp-per-cos\": {\n                \"mef-legato-services:bwp-flow-per-cos\": [\n                  {\n                    \"mef-legato-services:cos-name\": \"Neon\",\n                    \"envelope-id\": \"Rank 0\",\n                    \"rank\": \"0\"\n                  }\n                ]\n              },\n              \"egress-bwp-per-eec\": {\n                \"mef-legato-services:bwp-flow-per-eec\": [\n                  {\n                    \"mef-legato-services:eec-name\": \"EEC-Krypton\",\n                    \"envelope-id\": \"Rank 0\",\n                    \"rank\": \"0\"\n                  }\n                ]\n              }\n            }\n          ]\n        },\n        \"mef-legato-services:carrier-ethernet-sls\": {\n          \"mef-legato-services:sls-id\": \"SLSID1\",\n          \"mef-legato-services:start-time\": \"9372-84-27T31:46:58Z\",\n          \"mef-legato-services:cos-entries\": {\n            \"mef-legato-services:cos-entry\": [\n              {\n                \"mef-legato-services:cos-name\": \"Krypton\",\n                \"mef-legato-services:pm-entries\": {\n                  \"mef-legato-services:pm-entry\": [\n                    {\n                      \"mef-legato-services:pm-entry-id\": \"68\",\n                      \"mef-legato-services:sets-of-end-point-pairs\": {\n                        \"mef-legato-services:set-of-end-point-pairs\": [\n                          {\n                            \"mef-legato-services:index\": \"0\",\n                            \"sls-uni-exclusions\": {\n                              \"mef-legato-services:end-point-pair\": [\n                                {\n                                  \"mef-legato-services:end-point1\": \"1\",\n                                  \"mef-legato-services:end-point2\": \"2\"\n                                }\n                              ]\n                            }\n                          }\n                        ]\n                      },\n                      \"mef-legato-services:end-point-pairs\": {\n                        \"sls-uni-exclusions\": {\n                          \"mef-legato-services:end-point-pair\": [\n                            {\n                              \"mef-legato-services:end-point1\": \"1\",\n                              \"mef-legato-services:end-point2\": \"2\"\n                            }\n                          ]\n                        }\n                      }\n                    }\n                  ]\n                }\n              }\n            ]\n          }\n        },\n        \"mef-legato-services:connection-type\": \"multipoint-to-multipoint\",\n        \"mef-legato-services:admin-state\": \"true\",\n        \"mef-legato-services:user-label\": \"U4\",\n        \"mef-legato-services:max-frame-size\": \"1522\",\n        \"mef-legato-services:max-num-of-evc-end-point\": \"2\",\n        \"mef-legato-services:ce-vlan-id-preservation\": \"false\",\n        \"mef-legato-services:ce-vlan-pcp-preservation\": \"false\",\n        \"mef-legato-services:ce-vlan-dei-preservation\": \"false\",\n        \"mef-legato-services:unicast-frame-delivery\": \"unconditional\",\n        \"mef-legato-services:multicast-frame-delivery\": \"unconditional\",\n        \"mef-legato-services:broadcast-frame-delivery\": \"unconditional\",\n        \"mef-legato-services:svc-type\": \"evplan\"\n      }\n    ]  \n}  \n"
                },
                {
-                       "name": "Step 3 A - Get connnectivity service list - Presto",
-                       "request": {
-                               "url": "{{host}}/restconf/operations/tapi-connectivity:get-connectivity-service-list",
-                               "method": "POST",
-                               "header": [
-                                       {
-                                               "key": "Content-Type",
-                                               "value": "application/json",
-                                               "description": ""
-                                       },
-                                       {
-                                               "key": "Authorization",
-                                               "value": "Basic YWRtaW46YWRtaW4=",
-                                               "description": ""
-                                       }
-                               ],
-                               "body": {
-                                       "mode": "raw",
-                                       "raw": ""
+                       "id": "3f83f5e1-9139-30d1-8e86-db5df27da5d7",
+                       "name": "Step 3 C - Get list of EVC - Operational API",
+                       "description": "",
+                       "collectionId": "2a09e07a-31b1-2d00-58ca-97f6e6c30aa7",
+                       "method": "GET",
+                       "headers": "Content-Type: application/json\nAuthorization: Basic YWRtaW46YWRtaW4=",
+                       "dataMode": "raw",
+                       "data": [],
+                       "rawModeData": "",
+                       "url": "{{host}}/restconf/operational/mef-legato-services:mef-services",
+                       "responses": [],
+                       "pathVariableData": [],
+                       "queryParams": [],
+                       "headerData": [
+                               {
+                                       "key": "Content-Type",
+                                       "value": "application/json",
+                                       "description": ""
                                },
-                               "description": ""
-                       },
-                       "response": []
+                               {
+                                       "key": "Authorization",
+                                       "value": "Basic YWRtaW46YWRtaW4=",
+                                       "description": ""
+                               }
+                       ],
+                       "collection_id": "2a09e07a-31b1-2d00-58ca-97f6e6c30aa7"
                },
                {
-                       "name": "Step 3 B - Get list of EVC - Config API",
-                       "request": {
-                               "url": "{{host}}/restconf/config/mef-legato-services:mef-services/carrier-ethernet/subscriber-services/",
-                               "method": "GET",
-                               "header": [
-                                       {
-                                               "key": "Content-Type",
-                                               "value": "application/json",
-                                               "description": ""
-                                       },
-                                       {
-                                               "key": "Authorization",
-                                               "value": "Basic YWRtaW46YWRtaW4=",
-                                               "description": ""
-                                       }
-                               ],
-                               "body": {
-                                       "mode": "raw",
-                                       "raw": ""
+                       "id": "76715d27-331a-26b2-0b9a-fe13f906ce15",
+                       "name": "Step 1a - get Tapi Topology - mef:presto-nrp-topology",
+                       "description": "",
+                       "collectionId": "2a09e07a-31b1-2d00-58ca-97f6e6c30aa7",
+                       "method": "GET",
+                       "headers": "Authorization: Basic YWRtaW46YWRtaW4=",
+                       "dataMode": "raw",
+                       "data": [],
+                       "rawModeData": "",
+                       "url": "{{host}}/restconf/operational/tapi-common:context/tapi-topology:topology/mef:presto-nrp-topology",
+                       "responses": [],
+                       "pathVariableData": [],
+                       "queryParams": [],
+                       "headerData": [
+                               {
+                                       "key": "Authorization",
+                                       "value": "Basic YWRtaW46YWRtaW4=",
+                                       "description": ""
+                               }
+                       ],
+                       "collection_id": "2a09e07a-31b1-2d00-58ca-97f6e6c30aa7"
+               },
+               {
+                       "id": "8f82b9b3-9e2d-0922-bba8-d4966348a1f9",
+                       "headers": "Content-Type: application/json\nAuthorization: Basic YWRtaW46YWRtaW4=\n",
+                       "headerData": [
+                               {
+                                       "key": "Content-Type",
+                                       "value": "application/json",
+                                       "description": "",
+                                       "enabled": true
                                },
-                               "description": ""
-                       },
-                       "response": []
+                               {
+                                       "key": "Authorization",
+                                       "value": "Basic YWRtaW46YWRtaW4=",
+                                       "description": "",
+                                       "enabled": true
+                               }
+                       ],
+                       "url": "{{host}}/restconf/config/mef-legato-services:mef-services/carrier-ethernet/subscriber-services/evc/{{evc_id}}",
+                       "queryParams": [],
+                       "preRequestScript": null,
+                       "pathVariables": {},
+                       "pathVariableData": [],
+                       "method": "PUT",
+                       "data": [],
+                       "dataMode": "raw",
+                       "tests": null,
+                       "currentHelper": "normal",
+                       "helperAttributes": {},
+                       "time": 1563777773885,
+                       "name": "Step 2A - Create Ethernet Private Line (EPL) Service",
+                       "description": "Create Ethernet Private Line (EPL) Service",
+                       "collectionId": "2a09e07a-31b1-2d00-58ca-97f6e6c30aa7",
+                       "responses": [],
+                       "rawModeData": "{\n    \"mef-legato-services:evc\": [\n      {\n        \"mef-legato-services:evc-id\": \"{{evc_id}}\",\n        \"mef-legato-services:cos-names\": {\n          \"mef-legato-services:cos-name\": [\n            {\n              \"mef-legato-services:name\": \"EPL\"\n            }\n          ]\n        },\n        \"mef-legato-services:end-points\": {\n          \"mef-legato-services:end-point\": [\n            {\n              \"mef-legato-services:uni-id\": \"{{sip1_uuid}}\",\n              \"mef-legato-services:role\": \"root\",\n              \"mef-legato-services:admin-state\": \"true\",\n              \"mef-legato-services:color-identifier\": \"COLID1\",\n              \"mef-legato-services:cos-identifier\": \"COSID1\",\n              \"mef-legato-services:eec-identifier\": \"EECID1\",\n              \"mef-legato-services:source-mac-address-limit\": \"1\",\n              \"mef-legato-services:source-mac-address-limit-time-interval\": \"1\",\n              \"mef-legato-services:test-meg-enabled\": \"false\",\n              \"mef-legato-services:user-label\": \"admin\",\n              \"mef-legato-services:subscriber-meg-mip-enabled\": \"false\",\n              \"mef-legato-services:ce-vlans\": {\n                \"mef-legato-services:ce-vlan\": [\n                \t\t\"301\"\n            \t]\n              },\n              \"ingress-bwp-per-cos\": {\n                \"mef-legato-services:bwp-flow-per-cos\": [\n                  {\n                    \"mef-legato-services:cos-name\": \"Neon\",\n                    \"envelope-id\": \"Rank 0\",\n                    \"rank\": \"0\"\n                  }\n                ]\n              },\n              \"egress-bwp-per-eec\": {\n                \"mef-legato-services:bwp-flow-per-eec\": [\n                  {\n                    \"mef-legato-services:eec-name\": \"EEC-Krypton\",\n                    \"envelope-id\": \"Rank 0\",\n                    \"rank\": \"0\"\n                  }\n                ]\n              }\n            },\n\t\t\t{\n              \"mef-legato-services:uni-id\": \"{{sip2_uuid}}\",\n              \"mef-legato-services:role\": \"root\",\n              \"mef-legato-services:admin-state\": \"true\",\n              \"mef-legato-services:color-identifier\": \"COLID1\",\n              \"mef-legato-services:cos-identifier\": \"COSID1\",\n              \"mef-legato-services:eec-identifier\": \"EECID1\",\n              \"mef-legato-services:source-mac-address-limit\": \"1\",\n              \"mef-legato-services:source-mac-address-limit-time-interval\": \"1\",\n              \"mef-legato-services:test-meg-enabled\": \"false\",\n              \"mef-legato-services:user-label\": \"admin\",\n              \"mef-legato-services:subscriber-meg-mip-enabled\": \"false\",\n              \"mef-legato-services:ce-vlans\": {\n                \"mef-legato-services:ce-vlan\": [\n                \t\t\"301\"\n            \t]\n              },\n              \"ingress-bwp-per-cos\": {\n                \"mef-legato-services:bwp-flow-per-cos\": [\n                  {\n                    \"mef-legato-services:cos-name\": \"Neon\",\n                    \"envelope-id\": \"Rank 0\",\n                    \"rank\": \"0\"\n                  }\n                ]\n              },\n              \"egress-bwp-per-eec\": {\n                \"mef-legato-services:bwp-flow-per-eec\": [\n                  {\n                    \"mef-legato-services:eec-name\": \"EEC-Krypton\",\n                    \"envelope-id\": \"Rank 0\",\n                    \"rank\": \"0\"\n                  }\n                ]\n              }\n            }\n          ]\n        },\n        \"mef-legato-services:carrier-ethernet-sls\": {\n          \"mef-legato-services:sls-id\": \"SLSID1\",\n          \"mef-legato-services:start-time\": \"9372-84-27T31:46:58Z\",\n          \"mef-legato-services:cos-entries\": {\n            \"mef-legato-services:cos-entry\": [\n              {\n                \"mef-legato-services:cos-name\": \"Krypton\",\n                \"mef-legato-services:pm-entries\": {\n                  \"mef-legato-services:pm-entry\": [\n                    {\n                      \"mef-legato-services:pm-entry-id\": \"68\",\n                      \"mef-legato-services:sets-of-end-point-pairs\": {\n                        \"mef-legato-services:set-of-end-point-pairs\": [\n                          {\n                            \"mef-legato-services:index\": \"0\",\n                            \"sls-uni-exclusions\": {\n                              \"mef-legato-services:end-point-pair\": [\n                                {\n                                  \"mef-legato-services:end-point1\": \"1\",\n                                  \"mef-legato-services:end-point2\": \"2\"\n                                }\n                              ]\n                            }\n                          }\n                        ]\n                      },\n                      \"mef-legato-services:end-point-pairs\": {\n                        \"sls-uni-exclusions\": {\n                          \"mef-legato-services:end-point-pair\": [\n                            {\n                              \"mef-legato-services:end-point1\": \"1\",\n                              \"mef-legato-services:end-point2\": \"2\"\n                            }\n                          ]\n                        }\n                      }\n                    }\n                  ]\n                }\n              }\n            ]\n          }\n        },\n        \"mef-legato-services:connection-type\": \"point-to-point\",\n        \"mef-legato-services:admin-state\": \"true\",\n        \"mef-legato-services:user-label\": \"U4\",\n        \"mef-legato-services:max-frame-size\": \"1522\",\n        \"mef-legato-services:max-num-of-evc-end-point\": \"2\",\n        \"mef-legato-services:ce-vlan-id-preservation\": \"false\",\n        \"mef-legato-services:ce-vlan-pcp-preservation\": \"false\",\n        \"mef-legato-services:ce-vlan-dei-preservation\": \"false\",\n        \"mef-legato-services:unicast-frame-delivery\": \"unconditional\",\n        \"mef-legato-services:multicast-frame-delivery\": \"unconditional\",\n        \"mef-legato-services:broadcast-frame-delivery\": \"unconditional\",\n        \"mef-legato-services:svc-type\": \"epl\"\n      }\n    ]  \n}  \n"
                },
                {
-                       "name": "Step 3 C - Get list of EVC - Operational API",
-                       "request": {
-                               "url": "{{host}}/restconf/operational/mef-legato-services:mef-services",
-                               "method": "GET",
-                               "header": [
-                                       {
-                                               "key": "Content-Type",
-                                               "value": "application/json",
-                                               "description": ""
-                                       },
-                                       {
-                                               "key": "Authorization",
-                                               "value": "Basic YWRtaW46YWRtaW4=",
-                                               "description": ""
-                                       }
-                               ],
-                               "body": {
-                                       "mode": "raw",
-                                       "raw": ""
+                       "id": "9c64daa4-636b-480c-2398-c244da8872ad",
+                       "headers": "Content-Type: application/json\nAuthorization: Basic YWRtaW46YWRtaW4=\n",
+                       "headerData": [
+                               {
+                                       "key": "Content-Type",
+                                       "value": "application/json",
+                                       "description": "",
+                                       "enabled": true
                                },
-                               "description": ""
-                       },
-                       "response": []
+                               {
+                                       "key": "Authorization",
+                                       "value": "Basic YWRtaW46YWRtaW4=",
+                                       "description": "",
+                                       "enabled": true
+                               }
+                       ],
+                       "url": "{{host}}/restconf/config/mef-legato-services:mef-services/carrier-ethernet/subscriber-services/evc/{{evc_id}}",
+                       "queryParams": [],
+                       "preRequestScript": null,
+                       "pathVariables": {},
+                       "pathVariableData": [],
+                       "method": "PUT",
+                       "data": [],
+                       "dataMode": "raw",
+                       "tests": null,
+                       "currentHelper": "normal",
+                       "helperAttributes": {},
+                       "time": 1563778411189,
+                       "name": "Step 2C - Create Ethernet Private LAN (EPLAN) Service",
+                       "description": "Create Ethernet Private LAN (EPLAN) Service",
+                       "collectionId": "2a09e07a-31b1-2d00-58ca-97f6e6c30aa7",
+                       "responses": [],
+                       "rawModeData": "{\n    \"mef-legato-services:evc\": [\n      {\n        \"mef-legato-services:evc-id\": \"{{evc_id}}\",\n        \"mef-legato-services:cos-names\": {\n          \"mef-legato-services:cos-name\": [\n            {\n              \"mef-legato-services:name\": \"EPLAN\"\n            }\n          ]\n        },\n        \"mef-legato-services:end-points\": {\n          \"mef-legato-services:end-point\": [\n            {\n              \"mef-legato-services:uni-id\": \"{{sip1_uuid}}\",\n              \"mef-legato-services:role\": \"root\",\n              \"mef-legato-services:admin-state\": \"true\",\n              \"mef-legato-services:color-identifier\": \"COLID1\",\n              \"mef-legato-services:cos-identifier\": \"COSID1\",\n              \"mef-legato-services:eec-identifier\": \"EECID1\",\n              \"mef-legato-services:source-mac-address-limit\": \"1\",\n              \"mef-legato-services:source-mac-address-limit-time-interval\": \"1\",\n              \"mef-legato-services:test-meg-enabled\": \"false\",\n              \"mef-legato-services:user-label\": \"admin\",\n              \"mef-legato-services:subscriber-meg-mip-enabled\": \"false\",\n              \"mef-legato-services:ce-vlans\": {\n                \"mef-legato-services:ce-vlan\": [\n                \t\t\"301\"\n            \t]\n              },\n              \"ingress-bwp-per-cos\": {\n                \"mef-legato-services:bwp-flow-per-cos\": [\n                  {\n                    \"mef-legato-services:cos-name\": \"Neon\",\n                    \"envelope-id\": \"Rank 0\",\n                    \"rank\": \"0\"\n                  }\n                ]\n              },\n              \"egress-bwp-per-eec\": {\n                \"mef-legato-services:bwp-flow-per-eec\": [\n                  {\n                    \"mef-legato-services:eec-name\": \"EEC-Krypton\",\n                    \"envelope-id\": \"Rank 0\",\n                    \"rank\": \"0\"\n                  }\n                ]\n              }\n            },\n\t\t\t{\n              \"mef-legato-services:uni-id\": \"{{sip2_uuid}}\",\n              \"mef-legato-services:role\": \"root\",\n              \"mef-legato-services:admin-state\": \"true\",\n              \"mef-legato-services:color-identifier\": \"COLID1\",\n              \"mef-legato-services:cos-identifier\": \"COSID1\",\n              \"mef-legato-services:eec-identifier\": \"EECID1\",\n              \"mef-legato-services:source-mac-address-limit\": \"1\",\n              \"mef-legato-services:source-mac-address-limit-time-interval\": \"1\",\n              \"mef-legato-services:test-meg-enabled\": \"false\",\n              \"mef-legato-services:user-label\": \"admin\",\n              \"mef-legato-services:subscriber-meg-mip-enabled\": \"false\",\n              \"mef-legato-services:ce-vlans\": {\n                \"mef-legato-services:ce-vlan\": [\n                \t\t\"301\"\n            \t]\n              },\n              \"ingress-bwp-per-cos\": {\n                \"mef-legato-services:bwp-flow-per-cos\": [\n                  {\n                    \"mef-legato-services:cos-name\": \"Neon\",\n                    \"envelope-id\": \"Rank 0\",\n                    \"rank\": \"0\"\n                  }\n                ]\n              },\n              \"egress-bwp-per-eec\": {\n                \"mef-legato-services:bwp-flow-per-eec\": [\n                  {\n                    \"mef-legato-services:eec-name\": \"EEC-Krypton\",\n                    \"envelope-id\": \"Rank 0\",\n                    \"rank\": \"0\"\n                  }\n                ]\n              }\n            },\n             {\n              \"mef-legato-services:uni-id\": \"{{sip3_uuid}}\",\n              \"mef-legato-services:role\": \"root\",\n              \"mef-legato-services:admin-state\": \"true\",\n              \"mef-legato-services:color-identifier\": \"COLID1\",\n              \"mef-legato-services:cos-identifier\": \"COSID1\",\n              \"mef-legato-services:eec-identifier\": \"EECID1\",\n              \"mef-legato-services:source-mac-address-limit\": \"1\",\n              \"mef-legato-services:source-mac-address-limit-time-interval\": \"1\",\n              \"mef-legato-services:test-meg-enabled\": \"false\",\n              \"mef-legato-services:user-label\": \"admin\",\n              \"mef-legato-services:subscriber-meg-mip-enabled\": \"false\",\n              \"mef-legato-services:ce-vlans\": {\n                \"mef-legato-services:ce-vlan\": [\n                \t\t\"301\"\n            \t]\n              },\n              \"ingress-bwp-per-cos\": {\n                \"mef-legato-services:bwp-flow-per-cos\": [\n                  {\n                    \"mef-legato-services:cos-name\": \"Neon\",\n                    \"envelope-id\": \"Rank 0\",\n                    \"rank\": \"0\"\n                  }\n                ]\n              },\n              \"egress-bwp-per-eec\": {\n                \"mef-legato-services:bwp-flow-per-eec\": [\n                  {\n                    \"mef-legato-services:eec-name\": \"EEC-Krypton\",\n                    \"envelope-id\": \"Rank 0\",\n                    \"rank\": \"0\"\n                  }\n                ]\n              }\n            }\n          ]\n        },\n        \"mef-legato-services:carrier-ethernet-sls\": {\n          \"mef-legato-services:sls-id\": \"SLSID1\",\n          \"mef-legato-services:start-time\": \"9372-84-27T31:46:58Z\",\n          \"mef-legato-services:cos-entries\": {\n            \"mef-legato-services:cos-entry\": [\n              {\n                \"mef-legato-services:cos-name\": \"Krypton\",\n                \"mef-legato-services:pm-entries\": {\n                  \"mef-legato-services:pm-entry\": [\n                    {\n                      \"mef-legato-services:pm-entry-id\": \"68\",\n                      \"mef-legato-services:sets-of-end-point-pairs\": {\n                        \"mef-legato-services:set-of-end-point-pairs\": [\n                          {\n                            \"mef-legato-services:index\": \"0\",\n                            \"sls-uni-exclusions\": {\n                              \"mef-legato-services:end-point-pair\": [\n                                {\n                                  \"mef-legato-services:end-point1\": \"1\",\n                                  \"mef-legato-services:end-point2\": \"2\"\n                                }\n                              ]\n                            }\n                          }\n                        ]\n                      },\n                      \"mef-legato-services:end-point-pairs\": {\n                        \"sls-uni-exclusions\": {\n                          \"mef-legato-services:end-point-pair\": [\n                            {\n                              \"mef-legato-services:end-point1\": \"1\",\n                              \"mef-legato-services:end-point2\": \"2\"\n                            }\n                          ]\n                        }\n                      }\n                    }\n                  ]\n                }\n              }\n            ]\n          }\n        },\n        \"mef-legato-services:connection-type\": \"multipoint-to-multipoint\",\n        \"mef-legato-services:admin-state\": \"true\",\n        \"mef-legato-services:user-label\": \"U4\",\n        \"mef-legato-services:max-frame-size\": \"1522\",\n        \"mef-legato-services:max-num-of-evc-end-point\": \"2\",\n        \"mef-legato-services:ce-vlan-id-preservation\": \"false\",\n        \"mef-legato-services:ce-vlan-pcp-preservation\": \"false\",\n        \"mef-legato-services:ce-vlan-dei-preservation\": \"false\",\n        \"mef-legato-services:unicast-frame-delivery\": \"unconditional\",\n        \"mef-legato-services:multicast-frame-delivery\": \"unconditional\",\n        \"mef-legato-services:broadcast-frame-delivery\": \"unconditional\",\n        \"mef-legato-services:svc-type\": \"eplan\"\n      }\n    ]  \n}  \n"
                },
                {
-                       "name": "Step 4 - Delete EVC",
-                       "request": {
-                               "url": "{{host}}/restconf/config/mef-legato-services:mef-services/carrier-ethernet/subscriber-services/evc/{{evc_id}}",
-                               "method": "DELETE",
-                               "header": [
-                                       {
-                                               "key": "Content-Type",
-                                               "value": "application/json",
-                                               "description": ""
-                                       },
-                                       {
-                                               "key": "Authorization",
-                                               "value": "Basic YWRtaW46YWRtaW4=",
-                                               "description": ""
-                                       }
-                               ],
-                               "body": {
-                                       "mode": "raw",
-                                       "raw": ""
+                       "id": "b99ccfc0-15c9-824d-1f9f-cb7f88f1887a",
+                       "headers": "Content-Type: application/json\nAuthorization: Basic YWRtaW46YWRtaW4=\n",
+                       "headerData": [
+                               {
+                                       "key": "Content-Type",
+                                       "value": "application/json",
+                                       "description": "",
+                                       "enabled": true
                                },
-                               "description": ""
-                       },
-                       "response": []
+                               {
+                                       "key": "Authorization",
+                                       "value": "Basic YWRtaW46YWRtaW4=",
+                                       "description": "",
+                                       "enabled": true
+                               }
+                       ],
+                       "url": "{{host}}/restconf/config/mef-legato-services:mef-services/carrier-ethernet/subscriber-services/evc/{{evc_id}}",
+                       "queryParams": [],
+                       "preRequestScript": null,
+                       "pathVariables": {},
+                       "pathVariableData": [],
+                       "method": "PUT",
+                       "data": [],
+                       "dataMode": "raw",
+                       "tests": null,
+                       "currentHelper": "normal",
+                       "helperAttributes": {},
+                       "time": 1563777998371,
+                       "name": "Step 2B - Create Ethernet Virtual Private Line (EVPL) Service",
+                       "description": "Create Ethernet Virtual Private Line (EVPL) Service",
+                       "collectionId": "2a09e07a-31b1-2d00-58ca-97f6e6c30aa7",
+                       "responses": [],
+                       "rawModeData": "{\n    \"mef-legato-services:evc\": [\n      {\n        \"mef-legato-services:evc-id\": \"{{evc_id}}\",\n        \"mef-legato-services:cos-names\": {\n          \"mef-legato-services:cos-name\": [\n            {\n              \"mef-legato-services:name\": \"EVPL\"\n            }\n          ]\n        },\n        \"mef-legato-services:end-points\": {\n          \"mef-legato-services:end-point\": [\n            {\n              \"mef-legato-services:uni-id\": \"{{sip1_uuid}}\",\n              \"mef-legato-services:role\": \"root\",\n              \"mef-legato-services:admin-state\": \"true\",\n              \"mef-legato-services:color-identifier\": \"COLID1\",\n              \"mef-legato-services:cos-identifier\": \"COSID1\",\n              \"mef-legato-services:eec-identifier\": \"EECID1\",\n              \"mef-legato-services:source-mac-address-limit\": \"1\",\n              \"mef-legato-services:source-mac-address-limit-time-interval\": \"1\",\n              \"mef-legato-services:test-meg-enabled\": \"false\",\n              \"mef-legato-services:user-label\": \"admin\",\n              \"mef-legato-services:subscriber-meg-mip-enabled\": \"false\",\n              \"mef-legato-services:ce-vlans\": {\n                \"mef-legato-services:ce-vlan\": [\n                \t\t\"301\"\n            \t]\n              },\n              \"ingress-bwp-per-cos\": {\n                \"mef-legato-services:bwp-flow-per-cos\": [\n                  {\n                    \"mef-legato-services:cos-name\": \"Neon\",\n                    \"envelope-id\": \"Rank 0\",\n                    \"rank\": \"0\"\n                  }\n                ]\n              },\n              \"egress-bwp-per-eec\": {\n                \"mef-legato-services:bwp-flow-per-eec\": [\n                  {\n                    \"mef-legato-services:eec-name\": \"EEC-Krypton\",\n                    \"envelope-id\": \"Rank 0\",\n                    \"rank\": \"0\"\n                  }\n                ]\n              }\n            },\n\t\t\t{\n              \"mef-legato-services:uni-id\": \"{{sip2_uuid}}\",\n              \"mef-legato-services:role\": \"root\",\n              \"mef-legato-services:admin-state\": \"true\",\n              \"mef-legato-services:color-identifier\": \"COLID1\",\n              \"mef-legato-services:cos-identifier\": \"COSID1\",\n              \"mef-legato-services:eec-identifier\": \"EECID1\",\n              \"mef-legato-services:source-mac-address-limit\": \"1\",\n              \"mef-legato-services:source-mac-address-limit-time-interval\": \"1\",\n              \"mef-legato-services:test-meg-enabled\": \"false\",\n              \"mef-legato-services:user-label\": \"admin\",\n              \"mef-legato-services:subscriber-meg-mip-enabled\": \"false\",\n              \"mef-legato-services:ce-vlans\": {\n                \"mef-legato-services:ce-vlan\": [\n                \t\t\"301\"\n            \t]\n              },\n              \"ingress-bwp-per-cos\": {\n                \"mef-legato-services:bwp-flow-per-cos\": [\n                  {\n                    \"mef-legato-services:cos-name\": \"Neon\",\n                    \"envelope-id\": \"Rank 0\",\n                    \"rank\": \"0\"\n                  }\n                ]\n              },\n              \"egress-bwp-per-eec\": {\n                \"mef-legato-services:bwp-flow-per-eec\": [\n                  {\n                    \"mef-legato-services:eec-name\": \"EEC-Krypton\",\n                    \"envelope-id\": \"Rank 0\",\n                    \"rank\": \"0\"\n                  }\n                ]\n              }\n            }\n          ]\n        },\n        \"mef-legato-services:carrier-ethernet-sls\": {\n          \"mef-legato-services:sls-id\": \"SLSID1\",\n          \"mef-legato-services:start-time\": \"9372-84-27T31:46:58Z\",\n          \"mef-legato-services:cos-entries\": {\n            \"mef-legato-services:cos-entry\": [\n              {\n                \"mef-legato-services:cos-name\": \"Krypton\",\n                \"mef-legato-services:pm-entries\": {\n                  \"mef-legato-services:pm-entry\": [\n                    {\n                      \"mef-legato-services:pm-entry-id\": \"68\",\n                      \"mef-legato-services:sets-of-end-point-pairs\": {\n                        \"mef-legato-services:set-of-end-point-pairs\": [\n                          {\n                            \"mef-legato-services:index\": \"0\",\n                            \"sls-uni-exclusions\": {\n                              \"mef-legato-services:end-point-pair\": [\n                                {\n                                  \"mef-legato-services:end-point1\": \"1\",\n                                  \"mef-legato-services:end-point2\": \"2\"\n                                }\n                              ]\n                            }\n                          }\n                        ]\n                      },\n                      \"mef-legato-services:end-point-pairs\": {\n                        \"sls-uni-exclusions\": {\n                          \"mef-legato-services:end-point-pair\": [\n                            {\n                              \"mef-legato-services:end-point1\": \"1\",\n                              \"mef-legato-services:end-point2\": \"2\"\n                            }\n                          ]\n                        }\n                      }\n                    }\n                  ]\n                }\n              }\n            ]\n          }\n        },\n        \"mef-legato-services:connection-type\": \"point-to-point\",\n        \"mef-legato-services:admin-state\": \"true\",\n        \"mef-legato-services:user-label\": \"U4\",\n        \"mef-legato-services:max-frame-size\": \"1522\",\n        \"mef-legato-services:max-num-of-evc-end-point\": \"2\",\n        \"mef-legato-services:ce-vlan-id-preservation\": \"false\",\n        \"mef-legato-services:ce-vlan-pcp-preservation\": \"false\",\n        \"mef-legato-services:ce-vlan-dei-preservation\": \"false\",\n        \"mef-legato-services:unicast-frame-delivery\": \"unconditional\",\n        \"mef-legato-services:multicast-frame-delivery\": \"unconditional\",\n        \"mef-legato-services:broadcast-frame-delivery\": \"unconditional\",\n        \"mef-legato-services:svc-type\": \"evpl\"\n      }\n    ]  \n}  \n"
                },
                {
-                       "name": "del OVSDB Node",
-                       "request": {
-                               "url": "{{host}}/restconf/config/network-topology:network-topology/topology/ovsdb%3A1/node/odl",
-                               "method": "DELETE",
-                               "header": [
-                                       {
-                                               "key": "Content-Type",
-                                               "value": "application/json",
-                                               "description": ""
-                                       },
-                                       {
-                                               "key": "Authorization",
-                                               "value": "Basic YWRtaW46YWRtaW4=",
-                                               "description": ""
-                                       }
-                               ],
-                               "body": {
-                                       "mode": "raw",
-                                       "raw": ""
+                       "id": "d3ece99f-9a6f-294a-b334-9cd52e4539f8",
+                       "name": "Step 0 Init - add OVSDB Node",
+                       "description": "",
+                       "collectionId": "2a09e07a-31b1-2d00-58ca-97f6e6c30aa7",
+                       "method": "POST",
+                       "headers": "Content-Type: application/json\nAuthorization: Basic YWRtaW46YWRtaW4=",
+                       "dataMode": "raw",
+                       "data": [],
+                       "rawModeData": "{\n    \"node\": [\n        {\n            \"node-id\": \"odl\",\n            \"connection-info\": {\n              \"remote-ip\": \"{{mininet_ip_address}}\",\n              \"remote-port\": 6640\n            }\n        }\n    ]\n}",
+                       "url": "{{host}}/restconf/config/network-topology:network-topology/topology/ovsdb:1/",
+                       "responses": [],
+                       "pathVariableData": [],
+                       "queryParams": [],
+                       "headerData": [
+                               {
+                                       "key": "Content-Type",
+                                       "value": "application/json",
+                                       "description": ""
+                               },
+                               {
+                                       "key": "Authorization",
+                                       "value": "Basic YWRtaW46YWRtaW4=",
+                                       "description": ""
+                               }
+                       ],
+                       "collection_id": "2a09e07a-31b1-2d00-58ca-97f6e6c30aa7"
+               },
+               {
+                       "id": "e1565740-4cf4-c225-0523-21c1529537aa",
+                       "name": "Step 4 - Delete EVC",
+                       "description": "",
+                       "collectionId": "2a09e07a-31b1-2d00-58ca-97f6e6c30aa7",
+                       "method": "DELETE",
+                       "headers": "Content-Type: application/json\nAuthorization: Basic YWRtaW46YWRtaW4=",
+                       "dataMode": "raw",
+                       "data": [],
+                       "rawModeData": "",
+                       "url": "{{host}}/restconf/config/mef-legato-services:mef-services/carrier-ethernet/subscriber-services/evc/{{evc_id}}",
+                       "responses": [],
+                       "pathVariableData": [],
+                       "queryParams": [],
+                       "headerData": [
+                               {
+                                       "key": "Content-Type",
+                                       "value": "application/json",
+                                       "description": ""
                                },
-                               "description": ""
-                       },
-                       "response": []
+                               {
+                                       "key": "Authorization",
+                                       "value": "Basic YWRtaW46YWRtaW4=",
+                                       "description": ""
+                               }
+                       ],
+                       "collection_id": "2a09e07a-31b1-2d00-58ca-97f6e6c30aa7"
                },
                {
+                       "id": "e2649316-9827-88bd-ae66-2cbb42b845ec",
                        "name": "Init - get OVSDB Node",
-                       "request": {
-                               "url": "{{host}}/restconf/config/network-topology:network-topology",
-                               "method": "GET",
-                               "header": [
-                                       {
-                                               "key": "Content-Type",
-                                               "value": "application/json",
-                                               "description": ""
-                                       },
-                                       {
-                                               "key": "Authorization",
-                                               "value": "Basic YWRtaW46YWRtaW4=",
-                                               "description": ""
-                                       },
-                                       {
-                                               "key": "Accept",
-                                               "value": "application/json",
-                                               "description": ""
-                                       }
-                               ],
-                               "body": {
-                                       "mode": "raw",
-                                       "raw": "{\n    \"node\": [\n        {\n            \"node-id\": \"odl\",\n            \"connection-info\": {\n              \"remote-ip\": \"127.0.0.1\",\n              \"remote-port\": 6640\n            }\n        }\n    ]\n}"
+                       "description": "",
+                       "collectionId": "2a09e07a-31b1-2d00-58ca-97f6e6c30aa7",
+                       "method": "GET",
+                       "headers": "Content-Type: application/json\nAuthorization: Basic YWRtaW46YWRtaW4=\nAccept: application/json",
+                       "dataMode": "raw",
+                       "data": [],
+                       "rawModeData": "{\n    \"node\": [\n        {\n            \"node-id\": \"odl\",\n            \"connection-info\": {\n              \"remote-ip\": \"127.0.0.1\",\n              \"remote-port\": 6640\n            }\n        }\n    ]\n}",
+                       "url": "{{host}}/restconf/config/network-topology:network-topology",
+                       "responses": [],
+                       "pathVariableData": [],
+                       "queryParams": [],
+                       "headerData": [
+                               {
+                                       "key": "Content-Type",
+                                       "value": "application/json",
+                                       "description": ""
+                               },
+                               {
+                                       "key": "Authorization",
+                                       "value": "Basic YWRtaW46YWRtaW4=",
+                                       "description": ""
+                               },
+                               {
+                                       "key": "Accept",
+                                       "value": "application/json",
+                                       "description": ""
+                               }
+                       ],
+                       "collection_id": "2a09e07a-31b1-2d00-58ca-97f6e6c30aa7"
+               },
+               {
+                       "id": "fb9684fe-407b-3ba2-9860-e9c28ec8e1eb",
+                       "headers": "Content-Type: application/json\nAuthorization: Basic YWRtaW46YWRtaW4=\n",
+                       "headerData": [
+                               {
+                                       "key": "Content-Type",
+                                       "value": "application/json",
+                                       "description": "",
+                                       "enabled": true
                                },
-                               "description": ""
-                       },
-                       "response": []
+                               {
+                                       "key": "Authorization",
+                                       "value": "Basic YWRtaW46YWRtaW4=",
+                                       "description": "",
+                                       "enabled": true
+                               }
+                       ],
+                       "url": "{{host}}/restconf/config/mef-legato-services:mef-services/carrier-ethernet/subscriber-services/evc/{{evc_id}}",
+                       "queryParams": [],
+                       "preRequestScript": null,
+                       "pathVariables": {},
+                       "pathVariableData": [],
+                       "method": "PUT",
+                       "data": [],
+                       "dataMode": "raw",
+                       "tests": null,
+                       "currentHelper": "normal",
+                       "helperAttributes": {},
+                       "time": 1563779507394,
+                       "name": "Step 2E - Create Ethernet Private Tree (EPTREE) service ",
+                       "description": "Create Ethernet Private Tree (EPTREE) service ",
+                       "collectionId": "2a09e07a-31b1-2d00-58ca-97f6e6c30aa7",
+                       "responses": [],
+                       "rawModeData": "{\n    \"mef-legato-services:evc\": [\n      {\n        \"mef-legato-services:evc-id\": \"{{evc_id}}\",\n        \"mef-legato-services:cos-names\": {\n          \"mef-legato-services:cos-name\": [\n            {\n              \"mef-legato-services:name\": \"EPTREE\"\n            }\n          ]\n        },\n        \"mef-legato-services:end-points\": {\n          \"mef-legato-services:end-point\": [\n            {\n              \"mef-legato-services:uni-id\": \"{{sip1_uuid}}\",\n              \"mef-legato-services:role\": \"root\",\n              \"mef-legato-services:admin-state\": \"true\",\n              \"mef-legato-services:color-identifier\": \"COLID1\",\n              \"mef-legato-services:cos-identifier\": \"COSID1\",\n              \"mef-legato-services:eec-identifier\": \"EECID1\",\n              \"mef-legato-services:source-mac-address-limit\": \"1\",\n              \"mef-legato-services:source-mac-address-limit-time-interval\": \"1\",\n              \"mef-legato-services:test-meg-enabled\": \"false\",\n              \"mef-legato-services:user-label\": \"admin\",\n              \"mef-legato-services:subscriber-meg-mip-enabled\": \"false\",\n              \"mef-legato-services:ce-vlans\": {\n                \"mef-legato-services:ce-vlan\": [\n                \t\t\"301\"\n            \t]\n              },\n              \"ingress-bwp-per-cos\": {\n                \"mef-legato-services:bwp-flow-per-cos\": [\n                  {\n                    \"mef-legato-services:cos-name\": \"Neon\",\n                    \"envelope-id\": \"Rank 0\",\n                    \"rank\": \"0\"\n                  }\n                ]\n              },\n              \"egress-bwp-per-eec\": {\n                \"mef-legato-services:bwp-flow-per-eec\": [\n                  {\n                    \"mef-legato-services:eec-name\": \"EEC-Krypton\",\n                    \"envelope-id\": \"Rank 0\",\n                    \"rank\": \"0\"\n                  }\n                ]\n              }\n            },\n\t\t\t{\n              \"mef-legato-services:uni-id\": \"{{sip2_uuid}}\",\n              \"mef-legato-services:role\": \"leaf\",\n              \"mef-legato-services:admin-state\": \"true\",\n              \"mef-legato-services:color-identifier\": \"COLID1\",\n              \"mef-legato-services:cos-identifier\": \"COSID1\",\n              \"mef-legato-services:eec-identifier\": \"EECID1\",\n              \"mef-legato-services:source-mac-address-limit\": \"1\",\n              \"mef-legato-services:source-mac-address-limit-time-interval\": \"1\",\n              \"mef-legato-services:test-meg-enabled\": \"false\",\n              \"mef-legato-services:user-label\": \"admin\",\n              \"mef-legato-services:subscriber-meg-mip-enabled\": \"false\",\n              \"mef-legato-services:ce-vlans\": {\n                \"mef-legato-services:ce-vlan\": [\n                \t\t\"301\"\n            \t]\n              },\n              \"ingress-bwp-per-cos\": {\n                \"mef-legato-services:bwp-flow-per-cos\": [\n                  {\n                    \"mef-legato-services:cos-name\": \"Neon\",\n                    \"envelope-id\": \"Rank 0\",\n                    \"rank\": \"0\"\n                  }\n                ]\n              },\n              \"egress-bwp-per-eec\": {\n                \"mef-legato-services:bwp-flow-per-eec\": [\n                  {\n                    \"mef-legato-services:eec-name\": \"EEC-Krypton\",\n                    \"envelope-id\": \"Rank 0\",\n                    \"rank\": \"0\"\n                  }\n                ]\n              }\n            },\n             {\n              \"mef-legato-services:uni-id\": \"{{sip3_uuid}}\",\n              \"mef-legato-services:role\": \"leaf\",\n              \"mef-legato-services:admin-state\": \"true\",\n              \"mef-legato-services:color-identifier\": \"COLID1\",\n              \"mef-legato-services:cos-identifier\": \"COSID1\",\n              \"mef-legato-services:eec-identifier\": \"EECID1\",\n              \"mef-legato-services:source-mac-address-limit\": \"1\",\n              \"mef-legato-services:source-mac-address-limit-time-interval\": \"1\",\n              \"mef-legato-services:test-meg-enabled\": \"false\",\n              \"mef-legato-services:user-label\": \"admin\",\n              \"mef-legato-services:subscriber-meg-mip-enabled\": \"false\",\n              \"mef-legato-services:ce-vlans\": {\n                \"mef-legato-services:ce-vlan\": [\n                \t\t\"301\"\n            \t]\n              },\n              \"ingress-bwp-per-cos\": {\n                \"mef-legato-services:bwp-flow-per-cos\": [\n                  {\n                    \"mef-legato-services:cos-name\": \"Neon\",\n                    \"envelope-id\": \"Rank 0\",\n                    \"rank\": \"0\"\n                  }\n                ]\n              },\n              \"egress-bwp-per-eec\": {\n                \"mef-legato-services:bwp-flow-per-eec\": [\n                  {\n                    \"mef-legato-services:eec-name\": \"EEC-Krypton\",\n                    \"envelope-id\": \"Rank 0\",\n                    \"rank\": \"0\"\n                  }\n                ]\n              }\n            }\n          ]\n        },\n        \"mef-legato-services:carrier-ethernet-sls\": {\n          \"mef-legato-services:sls-id\": \"SLSID1\",\n          \"mef-legato-services:start-time\": \"9372-84-27T31:46:58Z\",\n          \"mef-legato-services:cos-entries\": {\n            \"mef-legato-services:cos-entry\": [\n              {\n                \"mef-legato-services:cos-name\": \"Krypton\",\n                \"mef-legato-services:pm-entries\": {\n                  \"mef-legato-services:pm-entry\": [\n                    {\n                      \"mef-legato-services:pm-entry-id\": \"68\",\n                      \"mef-legato-services:sets-of-end-point-pairs\": {\n                        \"mef-legato-services:set-of-end-point-pairs\": [\n                          {\n                            \"mef-legato-services:index\": \"0\",\n                            \"sls-uni-exclusions\": {\n                              \"mef-legato-services:end-point-pair\": [\n                                {\n                                  \"mef-legato-services:end-point1\": \"1\",\n                                  \"mef-legato-services:end-point2\": \"2\"\n                                }\n                              ]\n                            }\n                          }\n                        ]\n                      },\n                      \"mef-legato-services:end-point-pairs\": {\n                        \"sls-uni-exclusions\": {\n                          \"mef-legato-services:end-point-pair\": [\n                            {\n                              \"mef-legato-services:end-point1\": \"1\",\n                              \"mef-legato-services:end-point2\": \"2\"\n                            }\n                          ]\n                        }\n                      }\n                    }\n                  ]\n                }\n              }\n            ]\n          }\n        },\n        \"mef-legato-services:connection-type\": \"rooted-multipoint\",\n        \"mef-legato-services:admin-state\": \"true\",\n        \"mef-legato-services:user-label\": \"U4\",\n        \"mef-legato-services:max-frame-size\": \"1522\",\n        \"mef-legato-services:max-num-of-evc-end-point\": \"2\",\n        \"mef-legato-services:ce-vlan-id-preservation\": \"false\",\n        \"mef-legato-services:ce-vlan-pcp-preservation\": \"false\",\n        \"mef-legato-services:ce-vlan-dei-preservation\": \"false\",\n        \"mef-legato-services:unicast-frame-delivery\": \"unconditional\",\n        \"mef-legato-services:multicast-frame-delivery\": \"unconditional\",\n        \"mef-legato-services:broadcast-frame-delivery\": \"unconditional\",\n        \"mef-legato-services:svc-type\": \"eptree\"\n      }\n    ]  \n}  \n"
                }
        ]
 }
\ No newline at end of file
diff --git a/resources/create_etree_topology.py b/resources/create_etree_topology.py
new file mode 100755 (executable)
index 0000000..d7e94fe
--- /dev/null
@@ -0,0 +1,111 @@
+#!/usr/bin/python\r
+\r
+"""\r
+  Copyright (c) 2018 Xoriant Corporation and others. All rights reserved.\r
\r
+  This program and the accompanying materials are made available under \r
+  the terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
+  and is available at http://www.eclipse.org/legal/epl-v10.html\r
\r
+"""\r
+\r
+import re\r
+import sys\r
+import os\r
+import time\r
+\r
+from mininet.cli import CLI\r
+from mininet.log import setLogLevel, info, error\r
+from mininet.net import Mininet\r
+from mininet.link import Intf\r
+from mininet.util import quietRun\r
+from mininet.node import Controller, RemoteController\r
+from mininet.topo import Topo\r
+from mininet.node import Node\r
+from mininet.util import waitListening\r
+from functools import partial\r
+from mininet.node import OVSSwitch\r
+\r
+class PocTopo( Topo ):\r
+       "Topology prepared for Presto NRP tutorial"\r
+\r
+       def __init__( self ):\r
+\r
+        # Initialize topology\r
+               Topo.__init__( self )\r
+\r
+               # Add hosts and switches\r
+               l1 = self.addHost( 'L1' )\r
+               \r
+               l2 = self.addHost( 'L2' )\r
+\r
+               r1 = self.addHost( 'R1' )\r
+               \r
+               s1 = self.addSwitch( 's1' )\r
+               s2 = self.addSwitch( 's2' )\r
+               s3 = self.addSwitch( 's3' )\r
+                s4 = self.addSwitch( 's4' )\r
+        # Add links\r
+               self.addLink( r1, s1 )  \r
+               self.addLink( l1, s2 )\r
+               self.addLink( l2, s3 )\r
+\r
+               self.addLink( s1, s4 )\r
+                self.addLink( s2, s4 )\r
+                self.addLink( s3, s4 )\r
+\r
+\r
+#topos = { 'poctopo': ( lambda: PocTopo() ) }\r
+\r
+if __name__ == '__main__':\r
+       setLogLevel( 'info' )\r
+\r
+       os.system('ovs-vsctl set-manager ptcp:6640')\r
+\r
+       defaultIF1 = 'enp0s3'\r
+       defaultIF2 = 'enp0s8'\r
+        defaultIF3 = 'enp0s9'\r
+    #    defaultIF4 = 'enp0s10'\r
+       defaultControllerIP = '127.0.0.1'\r
+       defaultInputSwitch = 0\r
+       defaultOutputSwitch = 1\r
+\r
+    # try to get hw intfs from the command line; by default, use eth1 and eth2\r
+       odl_controller_ip = sys.argv[ 1 ] if len( sys.argv ) > 1 else defaultControllerIP\r
+       intfName = sys.argv[ 2 ] if len( sys.argv ) > 2 else ""\r
+       intfName2 = sys.argv[ 3 ] if len( sys.argv ) > 3 else ""\r
+        intfName3 = sys.argv[ 4 ] if len( sys.argv ) > 4 else ""\r
+        intfName4 = sys.argv[ 5 ] if len( sys.argv ) > 5 else ""\r
+       input_switch0 = 0\r
+       input_switch1 = 1\r
+        input_switch2 = 2\r
+     #   input_switch3 = 3\r
+\r
+       OVSSwitch13 = partial( OVSSwitch, protocols='OpenFlow13' )\r
+\r
+       topo = PocTopo( )\r
+\r
+       net = Mininet(topo, switch=OVSSwitch13, controller=partial( RemoteController, ip=odl_controller_ip, port=6633 ) )\r
+\r
+       if intfName != "":\r
+               switch = net.switches[ input_switch0 ]\r
+               info( '*** Adding hardware interface', intfName, 'to switch', switch.name, '\n' )\r
+               Intf( intfName, node=switch )\r
+\r
+       if intfName2 != "":\r
+               switch2 = net.switches[ input_switch1 ]\r
+               info( '*** Adding hardware interface', intfName2, 'to switch', switch2.name, '\n' )\r
+               Intf(intfName2, node=switch2)\r
+\r
+        if intfName3 != "":\r
+                switch3 = net.switches[ input_switch2 ]\r
+                info( '*** Adding hardware interface', intfName3, 'to switch', switch3.name, '\n' )\r
+                Intf(intfName3, node=switch3)\r
+        \r
+\r
+       net.start()\r
+\r
+#      os.system('ovs-ofctl -O OpenFlow13 del-flows s'+str(input_switch+1))\r
+#      os.system('ovs-ofctl -O OpenFlow13 del-flows s'+str(output_switch+1))\r
+       CLI( net )\r
+       net.stop()\r
similarity index 90%
rename from resources/create_topology_multipoint.py
rename to resources/create_lan_topology.py
index c2e92255410745314eb763b49306c33a4fcfcf4e..f972dd400a5919c0084aafa3f11eaab0173533fb 100755 (executable)
@@ -1,7 +1,12 @@
 #!/usr/bin/python
 
 """
-This script creates topology to experiment with ovs drivers.
+  Copyright (c) 2018 Xoriant Corporation and others. All rights reserved.
+  This program and the accompanying materials are made available under 
+  the terms of the Eclipse Public License v1.0 which accompanies this distribution,
+  and is available at http://www.eclipse.org/legal/epl-v10.html
 """
 
 import re
diff --git a/resources/tag301 b/resources/tag301
new file mode 100644 (file)
index 0000000..78cd5e3
--- /dev/null
@@ -0,0 +1,15 @@
+
+h1 ifconfig h1-eth0 0
+h1 vconfig rem h1-eth0.305 2> /dev/null
+h1 vconfig add h1-eth0 301 2> /dev/null
+h1 ifconfig h1-eth0.301 10.0.0.1
+
+h2 ifconfig h2-eth0 0
+h2 vconfig rem h2-eth0.305 2> /dev/null
+h2 vconfig add h2-eth0 301 2> /dev/null
+h2 ifconfig h2-eth0.301 10.0.0.2
+
+h3 ifconfig h3-eth0 0
+h3 vconfig rem h3-eth0.305 2> /dev/null
+h3 vconfig add h3-eth0 301 2> /dev/null
+h3 ifconfig h3-eth0.301 10.0.0.3
diff --git a/resources/tag305 b/resources/tag305
new file mode 100644 (file)
index 0000000..9d960e4
--- /dev/null
@@ -0,0 +1,14 @@
+h1 ifconfig h1-eth0 0
+h1 vconfig rem h1-eth0.301 2> /dev/null
+h1 vconfig add h1-eth0 305 2> /dev/null
+h1 ifconfig h1-eth0.305 10.0.0.1
+
+h2 ifconfig h2-eth0 0
+h2 vconfig rem h2-eth0.301 2> /dev/null
+h2 vconfig add h2-eth0 305 2> /dev/null
+h2 ifconfig h2-eth0.305 10.0.0.2
+
+h3 ifconfig h3-eth0 0
+h3 vconfig rem h3-eth0.301 2> /dev/null
+h3 vconfig add h3-eth0 305 2> /dev/null
+h3 ifconfig h3-eth0.305 10.0.0.3
diff --git a/resources/tagetree15 b/resources/tagetree15
new file mode 100644 (file)
index 0000000..3202c77
--- /dev/null
@@ -0,0 +1,17 @@
+L1 ifconfig L1-eth0 0
+L1 vconfig rem L1-eth0.301 2> /dev/null
+L1 vconfig add L1-eth0 15 2> /dev/null
+L1 ifconfig L1-eth0.15 10.0.0.1
+
+L2 ifconfig L2-eth0 0
+L2 vconfig rem L2-eth0.301 2> /dev/null
+L2 vconfig add L2-eth0 15 2> /dev/null
+L2 ifconfig L2-eth0.15 10.0.0.2
+
+R1 ifconfig R1-eth0 0
+R1 vconfig rem R1-eth0.301 2> /dev/null
+R1 vconfig add R1-eth0 15 2> /dev/null
+R1 ifconfig R1-eth0.15 10.0.0.3
+
+
+
diff --git a/resources/tagetree301 b/resources/tagetree301
new file mode 100644 (file)
index 0000000..79407c1
--- /dev/null
@@ -0,0 +1,17 @@
+L1 ifconfig L1-eth0 0
+L1 vconfig rem L1-eth0.15 2> /dev/null
+L1 vconfig add L1-eth0 301 2> /dev/null
+L1 ifconfig L1-eth0.301 10.0.0.1
+
+L2 ifconfig L2-eth0 0
+L2 vconfig rem L2-eth0.15 2> /dev/null
+L2 vconfig add L2-eth0 301 2> /dev/null
+L2 ifconfig L2-eth0.301 10.0.0.2
+
+R1 ifconfig R1-eth0 0
+R1 vconfig rem R1-eth0.15 2> /dev/null
+R1 vconfig add R1-eth0 301 2> /dev/null
+R1 ifconfig R1-eth0.301 10.0.0.3
+
+
+
diff --git a/resources/untag b/resources/untag
new file mode 100644 (file)
index 0000000..16d3d07
--- /dev/null
@@ -0,0 +1,11 @@
+h1 vconfig rem h1-eth0.301 2> /dev/null
+h1 vconfig rem h1-eth0.305 2> /dev/null
+h1 ifconfig h1-eth0 10.0.0.1
+
+h2 vconfig rem h2-eth0.301 2> /dev/null
+h2 vconfig rem h2-eth0.305 2> /dev/null
+h2 ifconfig h2-eth0 10.0.0.2
+
+h3 vconfig rem h3-eth0.301 2> /dev/null
+h3 vconfig rem h3-eth0.305 2> /dev/null
+h3 ifconfig h3-eth0 10.0.0.3 
diff --git a/resources/untagetree b/resources/untagetree
new file mode 100644 (file)
index 0000000..bbdb28b
--- /dev/null
@@ -0,0 +1,12 @@
+
+L1 vconfig rem L1-eth0.15 2> /dev/null
+L1 vconfig rem L1-eth0.301 2> /dev/null
+L1 ifconfig L1-eth0 10.0.0.1
+
+L2 vconfig rem L2-eth0.15 2> /dev/null
+L2 vconfig rem L2-eth0.301 2> /dev/null
+L2 ifconfig L2-eth0 10.0.0.2
+
+R1 vconfig rem R1-eth0.15 2> /dev/null
+R1 vconfig rem R1-eth0.301 2> /dev/null
+R1 ifconfig R1-eth0 10.0.0.3 
index fe7062420fca0d62f53245dd0f40fefc89d0b1fd..2896d566af552a3bf75c90614c56423cdc1b1233 100644 (file)
@@ -19,6 +19,7 @@ import org.opendaylight.unimgr.mef.nrp.api.EndPoint;
 import org.opendaylight.unimgr.mef.nrp.common.ResourceActivatorException;
 import org.opendaylight.unimgr.mef.nrp.template.TemplateConstants;
 import org.opendaylight.yang.gen.v1.urn.mef.yang.nrp._interface.rev180321.NrpConnectivityServiceAttrs;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev180307.ServiceType;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -41,6 +42,8 @@ public class TemplateDriver implements ActivationDriverBuilder {
 
             public List<EndPoint> endpoints;
             public String serviceId;
+            public boolean isExlusive;
+            public ServiceType serviceType;
 
             @Override
             public void commit() {
@@ -53,10 +56,11 @@ public class TemplateDriver implements ActivationDriverBuilder {
             }
 
             @Override
-            public void initialize(List<EndPoint> endPoints, String serviceId, NrpConnectivityServiceAttrs context) {
+            public void initialize(List<EndPoint> endPoints, String serviceId, NrpConnectivityServiceAttrs context, boolean isExlusive, ServiceType serviceType) {
                 this.serviceId = serviceId;
                 this.endpoints = new ArrayList<>(endPoints);
-
+                this.isExlusive = isExlusive;
+                this.serviceType = serviceType;
                 LOG.info("Driver initialized with: " + epsInfo());
             }