neutron: unbreak of neutron northbound yang model revise 56/40256/7
authorRitu Sood <ritu.sood@intel.com>
Mon, 13 Jun 2016 02:06:43 +0000 (19:06 -0700)
committerIsaku Yamahata <isaku.yamahata@intel.com>
Tue, 21 Jun 2016 01:49:15 +0000 (18:49 -0700)
This patch provides the corresponding change needed to fix
compilation issues after the Yang model revise of the
neutron-secgroups.yang.
https://git.opendaylight.org/gerrit/#/q/project:neutron+branch:master+topic:yang-model-revise

Change-Id: I6533ccb86a916c5ac9f6e818b197544b23fe1ab8
Signed-off-by: Ritu Sood <ritu.sood@intel.com>
Signed-off-by: Isaku Yamahata <isaku.yamahata@intel.com>
19 files changed:
features/pom.xml
features/src/main/features/features.xml
neutron-mapper/src/main/java/org/opendaylight/groupbasedpolicy/neutron/mapper/NeutronMapper.java
neutron-mapper/src/main/java/org/opendaylight/groupbasedpolicy/neutron/mapper/mapping/NeutronPortAware.java
neutron-mapper/src/main/java/org/opendaylight/groupbasedpolicy/neutron/mapper/mapping/NeutronSecurityGroupAware.java
neutron-mapper/src/main/java/org/opendaylight/groupbasedpolicy/neutron/mapper/mapping/NeutronSubnetAware.java
neutron-mapper/src/main/java/org/opendaylight/groupbasedpolicy/neutron/mapper/mapping/rule/SecRuleEntityDecoder.java
neutron-mapper/src/main/java/org/opendaylight/groupbasedpolicy/neutron/mapper/mapping/rule/SecRuleNameDecoder.java
neutron-mapper/src/main/java/org/opendaylight/groupbasedpolicy/neutron/mapper/util/SecurityRuleUtils.java
neutron-mapper/src/test/java/org/opendaylight/groupbasedpolicy/neutron/mapper/mapping/NeutronPortAwareDataStoreTest.java
neutron-mapper/src/test/java/org/opendaylight/groupbasedpolicy/neutron/mapper/mapping/NeutronRouterAwareDataStoreTest.java
neutron-mapper/src/test/java/org/opendaylight/groupbasedpolicy/neutron/mapper/mapping/NeutronSecurityGroupAwareDataStoreTest.java
neutron-mapper/src/test/java/org/opendaylight/groupbasedpolicy/neutron/mapper/mapping/rule/NeutronSecurityRuleAwareDataStoreTest.java
neutron-mapper/src/test/java/org/opendaylight/groupbasedpolicy/neutron/mapper/mapping/rule/NeutronSecurityRuleAwareTest.java
neutron-mapper/src/test/java/org/opendaylight/groupbasedpolicy/neutron/mapper/mapping/rule/SecRuleEntityDecoderTest.java
neutron-mapper/src/test/java/org/opendaylight/groupbasedpolicy/neutron/mapper/mapping/rule/SecRuleNameDecoderTest.java
neutron-mapper/src/test/java/org/opendaylight/groupbasedpolicy/neutron/mapper/test/NeutronEntityFactory.java
neutron-mapper/src/test/java/org/opendaylight/groupbasedpolicy/neutron/mapper/test/PolicyAssert.java
neutron-vpp-mapper/pom.xml

index 2bb1d8c3d1573b8439648479c72f0ee6eeacb57b..6d518b44fed2688b9470853f8a597603c8498f3e 100755 (executable)
       <version>${neutron.version}</version>
       <type>xml</type>
     </dependency>
-    <dependency>
-      <groupId>org.opendaylight.neutron</groupId>
-      <artifactId>dummyprovider</artifactId>
-      <version>${neutron.version}</version>
-    </dependency>
 
     <!-- Faas -->
     <dependency>
index bc6072c93a88d34a4c28c8d1c92161dbb404c043..133ca2ff856a8ffe052f5fb4474fa7d224de15b1 100755 (executable)
         <feature version="${neutron.version}">odl-neutron-service</feature>
         <feature version="${project.version}">odl-groupbasedpolicy-base</feature>
         <bundle>mvn:org.opendaylight.groupbasedpolicy/l2-l3-domain-extension/{{VERSION}}</bundle>
-        <bundle>mvn:org.opendaylight.neutron/dummyprovider/{{VERSION}}</bundle>
         <bundle>mvn:org.opendaylight.groupbasedpolicy/neutron-mapper/{{VERSION}}</bundle>
         <configfile finalname="${config.configfile.directory}/15-l2-l3-domain-extension.xml">mvn:org.opendaylight.groupbasedpolicy/l2-l3-domain-extension/{{VERSION}}/xml/config</configfile>
         <configfile finalname="${config.configfile.directory}/15-neutron-mapper.xml">mvn:org.opendaylight.groupbasedpolicy/neutron-mapper/{{VERSION}}/xml/config</configfile>
index 3309e03e65bfe23516c642a9dedb2212ae84eb8d..207fc3357819479ea344b40f6616515be69e8ed1 100644 (file)
@@ -69,27 +69,27 @@ import com.google.common.collect.PeekingIterator;
 public class NeutronMapper implements DataTreeChangeListener<Neutron>, AutoCloseable {
 
     private final static SecurityRuleBuilder EIG_INGRESS_IPV4_SEC_RULE_BUILDER = new SecurityRuleBuilder()
-        .setId(new Uuid("0a629f80-2408-11e6-b67b-9e71128cae77"))
+        .setUuid(new Uuid("0a629f80-2408-11e6-b67b-9e71128cae77"))
         .setDirection(DirectionIngress.class)
         .setEthertype(EthertypeV4.class)
         .setSecurityGroupId(MappingUtils.EIG_UUID);
     private final static SecurityRuleBuilder EIG_EGRESS_IPV4_SEC_RULE_BUILDER = new SecurityRuleBuilder()
-        .setId(new Uuid("0f1789be-2408-11e6-b67b-9e71128cae77"))
+        .setUuid(new Uuid("0f1789be-2408-11e6-b67b-9e71128cae77"))
         .setDirection(DirectionEgress.class)
         .setEthertype(EthertypeV4.class)
         .setSecurityGroupId(MappingUtils.EIG_UUID);
     private final static SecurityRuleBuilder EIG_INGRESS_IPV6_SEC_RULE_BUILDER = new SecurityRuleBuilder()
-        .setId(new Uuid("139b7f90-2408-11e6-b67b-9e71128cae77"))
+        .setUuid(new Uuid("139b7f90-2408-11e6-b67b-9e71128cae77"))
         .setDirection(DirectionIngress.class)
         .setEthertype(EthertypeV6.class)
         .setSecurityGroupId(MappingUtils.EIG_UUID);
     private final static SecurityRuleBuilder EIG_EGRESS_IPV6_SEC_RULE_BUILDER = new SecurityRuleBuilder()
-        .setId(new Uuid("17517202-2408-11e6-b67b-9e71128cae77"))
+        .setUuid(new Uuid("17517202-2408-11e6-b67b-9e71128cae77"))
         .setDirection(DirectionEgress.class)
         .setEthertype(EthertypeV6.class)
         .setSecurityGroupId(MappingUtils.EIG_UUID);
     private final static SecurityGroupBuilder EIG_SEC_GROUP_BUILDER =
-            new SecurityGroupBuilder().setUuid(MappingUtils.EIG_UUID).setDescription("EXTERNAL_group");
+            new SecurityGroupBuilder().setUuid(MappingUtils.EIG_UUID);
 
     private final NeutronNetworkAware networkAware;
     private final NeutronSecurityGroupAware securityGroupAware;
index 7bd5b1c188da01723a24ddf35ff5e13e61c28459..2b7ed54607d47f3122172f7776408edeeef33123 100644 (file)
@@ -322,7 +322,7 @@ public class NeutronPortAware implements NeutronAware<Port> {
     private AddressEndpointRegBuilder createBasicMacAddrEpInputBuilder(Port port,
             NetworkDomainId networkContainment, @Nullable List<EndpointGroupId> endpointGroupsToAdd) {
         AddressEndpointRegBuilder addrEpbuilder = new AddressEndpointRegBuilder().setAddressType(MacAddressType.class)
-            .setAddress(port.getMacAddress())
+            .setAddress(port.getMacAddress().getValue())
             .setAddressType(MacAddressType.class)
             .setContextType(MappingUtils.L2_BRDIGE_DOMAIN)
             .setContextId(new ContextId(port.getNetworkId().getValue()))
@@ -385,7 +385,7 @@ public class NeutronPortAware implements NeutronAware<Port> {
             Port port) {
         return new org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.endpoint.rev140421.RegisterEndpointInputBuilder().setL2Context(
                 new L2BridgeDomainId(port.getNetworkId().getValue()))
-            .setMacAddress(new MacAddress(port.getMacAddress()))
+            .setMacAddress(new MacAddress(port.getMacAddress().getValue()))
             .setTenant(new TenantId(port.getTenantId().getValue()))
             .setTimestamp(System.currentTimeMillis());
     }
@@ -412,7 +412,7 @@ public class NeutronPortAware implements NeutronAware<Port> {
         }
         UniqueId portId = new UniqueId(port.getUuid().getValue());
         EndpointKey epKey = new EndpointKey(new L2BridgeDomainId(port.getNetworkId().getValue()), new MacAddress(
-                port.getMacAddress()));
+                port.getMacAddress().getValue()));
         LOG.trace("Adding Port-Endpoint mapping for port {} (device owner {}) and endpoint {}", port.getUuid()
             .getValue(), port.getDeviceOwner(), epKey);
         EndpointByPort endpointByPort = MappingFactory.createEndpointByPort(epKey, portId);
@@ -431,7 +431,7 @@ public class NeutronPortAware implements NeutronAware<Port> {
         if (isUnregisteredEndpoint) {
             UniqueId portId = new UniqueId(port.getUuid().getValue());
             EndpointKey epKey = new EndpointKey(new L2BridgeDomainId(port.getNetworkId().getValue()), new MacAddress(
-                    port.getMacAddress()));
+                    port.getMacAddress().getValue()));
             LOG.trace("Removing Port-Endpoint mapping for port {} (device owner {}) and endpoint {}", port.getUuid()
                 .getValue(), port.getDeviceOwner(), epKey);
             DataStoreHelper.removeIfExists(LogicalDatastoreType.OPERATIONAL,
@@ -475,10 +475,10 @@ public class NeutronPortAware implements NeutronAware<Port> {
         if (isUnregisteredBaseEndpoint) {
             UniqueId portId = new UniqueId(port.getUuid().getValue());
             EndpointKey epKey = new EndpointKey(new L2BridgeDomainId(port.getNetworkId().getValue()), new MacAddress(
-                    port.getMacAddress()));
+                    port.getMacAddress().getValue()));
             LOG.trace("Removing Port-BaseEndpoint mapping for port {} (device owner {}) and endpoint {}",
                     port.getUuid().getValue(), port.getDeviceOwner(), epKey);
-            PortByBaseEndpointKey portByBaseEndpointKey = new PortByBaseEndpointKey(port.getMacAddress(),
+            PortByBaseEndpointKey portByBaseEndpointKey = new PortByBaseEndpointKey(port.getMacAddress().getValue(),
                     MacAddressType.class, new ContextId(port.getNetworkId().getValue()), MappingUtils.L2_BRDIGE_DOMAIN);
             DataStoreHelper.removeIfExists(LogicalDatastoreType.OPERATIONAL,
                     NeutronGbpIidFactory.baseEndpointByPortIid(portId), rwTx);
@@ -570,7 +570,7 @@ public class NeutronPortAware implements NeutronAware<Port> {
         UnregisterEndpointInputBuilder inputBuilder = new UnregisterEndpointInputBuilder();
         List<AddressEndpointUnreg> list = new ArrayList<>();
         AddressEndpointUnregBuilder addrL2EpUnregBuilder = new AddressEndpointUnregBuilder();
-        addrL2EpUnregBuilder.setAddress(port.getMacAddress())
+        addrL2EpUnregBuilder.setAddress(port.getMacAddress().getValue())
             .setAddressType(MacAddressType.class)
             .setContextId(new ContextId(port.getNetworkId().getValue()))
             .setContextType(MappingUtils.L2_BRDIGE_DOMAIN);
@@ -595,7 +595,7 @@ public class NeutronPortAware implements NeutronAware<Port> {
         org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.endpoint.rev140421.UnregisterEndpointInputBuilder inputBuilder =
                 new org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.endpoint.rev140421.UnregisterEndpointInputBuilder();
         L2 l2Ep = new L2Builder().setL2Context(new L2BridgeDomainId(port.getNetworkId().getValue()))
-            .setMacAddress(new MacAddress(port.getMacAddress()))
+            .setMacAddress(new MacAddress(port.getMacAddress().getValue()))
             .build();
         inputBuilder.setL2(ImmutableList.of(l2Ep));
         // we've registered EP with only first IP so remove only EP with first IP
index 4fac5829259f30277d1f7b3501dbe29cdbeb7d31..76b9edf6c6e05fd7f0ab029594fc6b5ccb0c9bdc 100644 (file)
@@ -74,15 +74,6 @@ public class NeutronSecurityGroupAware implements NeutronAware<SecurityGroup> {
                 LOG.debug("Name exception", e);
             }
         }
-        if (!Strings.isNullOrEmpty(secGroup.getDescription())) {
-            try {
-                epgBuilder.setDescription(new Description(secGroup.getDescription()));
-            } catch (Exception e) {
-                LOG.info("Description '{}' of Neutron Security-group '{}' is ignored.",
-                        secGroup.getDescription(), secGroup.getUuid().getValue());
-                LOG.debug("Description exception", e);
-            }
-        }
         epgBuilder.setIntraGroupPolicy(IntraGroupPolicy.RequireContract);
         rwTx.put(LogicalDatastoreType.CONFIGURATION, IidFactory.endpointGroupIid(tId, epgId),
                 epgBuilder.build(), true);
index 2c3037439cd4914dfd243b9e3c86ae57106d1164..9381f5b0a14841e6cff888af3eb88af69469e5ec 100644 (file)
@@ -16,7 +16,6 @@ import org.opendaylight.groupbasedpolicy.domain_extension.l2_l3.util.L2L3IidFact
 import org.opendaylight.groupbasedpolicy.neutron.mapper.EndpointRegistrator;
 import org.opendaylight.groupbasedpolicy.neutron.mapper.util.MappingUtils;
 import org.opendaylight.groupbasedpolicy.neutron.mapper.util.NetworkUtils;
-import org.opendaylight.groupbasedpolicy.neutron.mapper.util.Utils;
 import org.opendaylight.groupbasedpolicy.util.DataStoreHelper;
 import org.opendaylight.groupbasedpolicy.util.IidFactory;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.IpAddress;
@@ -106,7 +105,7 @@ public class NeutronSubnetAware implements
             org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.subnets.rev150712.subnets.attributes.subnets.Subnet subnet,
             IpAddress virtualRouterIp) {
         SubnetBuilder sb = new SubnetBuilder();
-        sb.setIpPrefix(Utils.createIpPrefix(subnet.getCidr()));
+        sb.setIpPrefix(subnet.getCidr());
         sb.setVirtualRouterIp(virtualRouterIp);
         NetworkDomainBuilder ndb = new NetworkDomainBuilder();
         if (!Strings.isNullOrEmpty(subnet.getName())) {
@@ -164,7 +163,7 @@ public class NeutronSubnetAware implements
                 LOG.debug("Name exception", e);
             }
         }
-        subnetBuilder.setIpPrefix(Utils.createIpPrefix(subnet.getCidr()));
+        subnetBuilder.setIpPrefix(subnet.getCidr());
         subnetBuilder.setVirtualRouterIp(virtualRouterIp);
         return subnetBuilder.build();
     }
index 579e858f8843ce5cafd84596523bf4ec029408de..f88d29562c8f76b02e51a5823aab6c8e8e109a39 100755 (executable)
@@ -55,6 +55,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.constants.rev150712
 import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.constants.rev150712.ProtocolIcmpV6;\r
 import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.constants.rev150712.ProtocolTcp;\r
 import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.constants.rev150712.ProtocolUdp;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.secgroups.rev150712.SecurityRuleAttributes;\r
 import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.secgroups.rev150712.security.rules.attributes.security.rules.SecurityRule;\r
 \r
 import com.google.common.collect.ImmutableList;\r
@@ -66,7 +67,7 @@ public class SecRuleEntityDecoder {
     }\r
 \r
     public static ContractId getContractId(SecurityRule secRule) {\r
-        return new ContractId(secRule.getId().getValue());\r
+        return new ContractId(secRule.getUuid().getValue());\r
     }\r
 \r
     public static ClassifierInstance getClassifierInstance(SecurityRule secRule) {\r
@@ -243,21 +244,26 @@ public class SecRuleEntityDecoder {
      *         {@link ProtocolUdp}, {@link ProtocolIcmp}, {@link ProtocolIcmpV6}\r
      */\r
     public static Long getProtocol(SecurityRule secRule) {\r
-        Class<? extends ProtocolBase> protocol = secRule.getProtocol();\r
+        SecurityRuleAttributes.Protocol protocol = secRule.getProtocol();\r
         if (protocol == null) {\r
             return null;\r
         }\r
-        if (protocol.isAssignableFrom(ProtocolTcp.class)) {\r
-            return IpProtoClassifierDefinition.TCP_VALUE;\r
+        if (protocol.getUint8() != null) {\r
+            return protocol.getUint8().longValue();\r
         }\r
-        if (protocol.isAssignableFrom(ProtocolUdp.class)) {\r
-            return IpProtoClassifierDefinition.UDP_VALUE;\r
-        }\r
-        if (protocol.isAssignableFrom(ProtocolIcmp.class)) {\r
-            return IpProtoClassifierDefinition.ICMP_VALUE;\r
-        }\r
-        if (protocol.isAssignableFrom(ProtocolIcmpV6.class)) {\r
-            return IpProtoClassifierDefinition.ICMPv6_VALUE;\r
+        if (protocol.getIdentityref() != null) {\r
+            if (protocol.getIdentityref().equals(ProtocolTcp.class)) {\r
+                return IpProtoClassifierDefinition.TCP_VALUE;\r
+            }\r
+            if (protocol.getIdentityref().equals(ProtocolUdp.class)) {\r
+                return IpProtoClassifierDefinition.UDP_VALUE;\r
+            }\r
+            if (protocol.getIdentityref().equals(ProtocolIcmp.class)) {\r
+                return IpProtoClassifierDefinition.ICMP_VALUE;\r
+            }\r
+            if (protocol.getIdentityref().equals(ProtocolIcmpV6.class)) {\r
+                return IpProtoClassifierDefinition.ICMPv6_VALUE;\r
+            }\r
         }\r
         throw new IllegalArgumentException("Neutron Security Rule Protocol value " + protocol + " is not supported.");\r
     }\r
index cfaa2de99fbecb93b8d072eb2f961ea6e843887e..9592c5ec0b1b66bcb4c9baa82cabfbbbf4ce3011 100644 (file)
@@ -21,6 +21,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.common.rev
 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.policy.rev140421.HasDirection.Direction;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.constants.rev150712.EthertypeBase;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.constants.rev150712.ProtocolBase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.secgroups.rev150712.SecurityRuleAttributes;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.secgroups.rev150712.security.rules.attributes.security.rules.SecurityRule;
 
 public class SecRuleNameDecoder {
@@ -76,14 +77,20 @@ public class SecRuleNameDecoder {
                     .append(portMax.longValue());
             }
         }
-        Class<? extends ProtocolBase> protocol = secRule.getProtocol();
+        SecurityRuleAttributes.Protocol protocol = secRule.getProtocol();
         if (protocol != null) {
             if (keyBuilder.length() > 0) {
                 keyBuilder.append(MappingUtils.NAME_DOUBLE_DELIMETER);
             }
+            String protocolString = "";
+            if (protocol.getUint8() != null) {
+                protocolString = protocol.getUint8().toString();
+            } else if (protocol.getIdentityref() != null) {
+                protocolString = protocol.getIdentityref().getSimpleName();
+            }
             keyBuilder.append(IpProtoClassifierDefinition.DEFINITION.getName().getValue())
                 .append(MappingUtils.NAME_VALUE_DELIMETER)
-                .append(protocol.getSimpleName());
+                .append(protocolString);
         }
         Class<? extends EthertypeBase> ethertype = secRule.getEthertype();
         if (ethertype != null) {
index c96de98ee7cf7e7607b1271223bc5b0c2f5bda3b..b85576306f08da4e89c848f6bc519ed4a26e34f1 100644 (file)
@@ -33,7 +33,7 @@ public class SecurityRuleUtils {
             return Optional.absent();
         }
         for (SecurityRule secRule : securityRules.getSecurityRule()) {
-            if (secRule.getId().equals(uuid)) {
+            if (secRule.getUuid().equals(uuid)) {
                 return Optional.of(secRule);
             }
         }
index a5d1f4d4502828c61ae425932d0b41d4924f9e2c..ce53a0b1c533ecd2f2a4e7eabd9bd132bc02ee8a 100644 (file)
@@ -24,8 +24,10 @@ import org.opendaylight.groupbasedpolicy.neutron.mapper.EndpointRegistrator;
 import org.opendaylight.groupbasedpolicy.neutron.mapper.test.NeutronMapperAssert;
 import org.opendaylight.groupbasedpolicy.neutron.mapper.test.NeutronMapperDataBrokerTest;
 import org.opendaylight.groupbasedpolicy.neutron.mapper.util.PortUtils;
+import org.opendaylight.groupbasedpolicy.neutron.mapper.util.Utils;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.IpAddress;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Ipv4Address;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Uuid;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.base_endpoint.rev160427.RegisterEndpointInput;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.base_endpoint.rev160427.UnregisterEndpointInput;
@@ -166,7 +168,7 @@ public class NeutronPortAwareDataStoreTest extends NeutronMapperDataBrokerTest {
             .setDeviceId("deviceId")
             .setFixedIps(ImmutableList.of(portIpWithSubnet))
             .setNetworkId(networkUuid)
-            .setMacAddress("00:00:00:00:35:02")
+            .setMacAddress(new MacAddress("00:00:00:00:35:02"))
             .build();
         Port neutronPort2 = new PortBuilder().setTenantId(new Uuid(tenantUuid))
             .setFixedIps(ImmutableList.of(portIpWithSubnet))
@@ -176,7 +178,7 @@ public class NeutronPortAwareDataStoreTest extends NeutronMapperDataBrokerTest {
             .setDeviceOwner(PortUtils.DEVICE_OWNER_DHCP)
             .setFixedIps(ImmutableList.of(portIpWithSubnet))
             .setNetworkId(networkUuid)
-            .setMacAddress("00:00:00:00:35:02")
+            .setMacAddress(new MacAddress("00:00:00:00:35:02"))
             .build();
         Ports neutronPorts = new PortsBuilder().setPort(ImmutableList.of(neutronPort1, neutronPort2)).build();
         when(neutron.getPorts()).thenReturn(neutronPorts);
@@ -229,7 +231,7 @@ public class NeutronPortAwareDataStoreTest extends NeutronMapperDataBrokerTest {
             .setUuid(portUuid)
             .setDeviceId("deviceId")
             .setNetworkId(networkUuid)
-            .setMacAddress("00:00:00:00:35:02");
+            .setMacAddress(new MacAddress("00:00:00:00:35:02"));
     }
 
     private Subnets createSubnets() {
@@ -237,7 +239,7 @@ public class NeutronPortAwareDataStoreTest extends NeutronMapperDataBrokerTest {
             .setUuid(subnetUuid)
             .setName("subnetName")
             .setNetworkId(networkUuid)
-            .setCidr("10.0.0.0/24")
+            .setCidr(Utils.createIpPrefix("10.0.0.0/24"))
             .build();
         return new SubnetsBuilder().setSubnet(ImmutableList.of(subnet)).build();
     }
index f7fb7305f951fb77de25346f11ac3f88e3b34ab4..8b4c46190d5c9d134afd42e5ed1bc2be15e8f928 100644 (file)
@@ -30,6 +30,7 @@ import org.opendaylight.controller.md.sal.binding.api.ReadOnlyTransaction;
 import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
 import org.opendaylight.groupbasedpolicy.neutron.mapper.EndpointRegistrator;
 import org.opendaylight.groupbasedpolicy.neutron.mapper.test.NeutronMapperDataBrokerTest;
+import org.opendaylight.groupbasedpolicy.neutron.mapper.util.Utils;
 import org.opendaylight.groupbasedpolicy.util.DataStoreHelper;
 import org.opendaylight.groupbasedpolicy.util.IidFactory;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.IpAddress;
@@ -314,7 +315,7 @@ public class NeutronRouterAwareDataStoreTest extends NeutronMapperDataBrokerTest
             .setName("subnetName")
             .setNetworkId(networkUuid)
             .setGatewayIp(ipAddress)
-            .setCidr("10.0.0.0/24")
+            .setCidr(Utils.createIpPrefix("10.0.0.0/24"))
             .build();
         return new SubnetsBuilder().setSubnet(ImmutableList.of(subnet)).build();
     }
index 90fc4ad67c3301dd81dfb21ab6a082ca0dfc3e12..9cc2f53d4ceb7fa9a889572d4e655d7ffba4fd77 100644 (file)
@@ -107,7 +107,6 @@ public class NeutronSecurityGroupAwareDataStoreTest extends NeutronMapperDataBro
         SecurityGroup secGroupA = new SecurityGroupBuilder().setUuid(new Uuid(uuid))
             .setTenantId(new Uuid(tenantId))
             .setName("correctName")
-            .setDescription("correct description")
             .build();
         groupAware.onCreated(secGroupA, null);
 
@@ -121,7 +120,6 @@ public class NeutronSecurityGroupAwareDataStoreTest extends NeutronMapperDataBro
         SecurityGroup secGroupA = new SecurityGroupBuilder().setUuid(new Uuid(uuid))
             .setTenantId(new Uuid(tenantId))
             .setName("123")
-            .setDescription(longDescription)
             .build();
         groupAware.onCreated(secGroupA, null);
 
index 9d3c199983760401578353d2a6f9e83dee45ea4d..0b5606ca5417756fed57f68fa40f67629f5d29cb 100644 (file)
@@ -31,6 +31,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.constants.rev150712
 import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.constants.rev150712.ProtocolTcp;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.rev150712.Neutron;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.rev150712.NeutronBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.secgroups.rev150712.SecurityRuleAttributes;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.secgroups.rev150712.security.groups.attributes.SecurityGroupsBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.secgroups.rev150712.security.groups.attributes.security.groups.SecurityGroup;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.secgroups.rev150712.security.rules.attributes.SecurityRulesBuilder;
@@ -59,17 +60,18 @@ public class NeutronSecurityRuleAwareDataStoreTest extends NeutronMapperDataBrok
                 "dabfd4da-af89-45dd-85f8-181768c1b4c9", tenant, EthertypeV4.class, DirectionEgress.class, goldSecGrp,
                 null);
         String serverSecGrp = "71cf4fe5-b146-409e-8151-cd921298ce32";
-        SecurityRule serverIn80Tcp10_1_1_0 = new SecurityRuleBuilder().setId(new Uuid("9dbb533d-d9b2-4dc9-bae7-ee60c8df184d"))
+        SecurityRuleAttributes.Protocol protocolTcp = new SecurityRuleAttributes.Protocol(ProtocolTcp.class);
+        SecurityRule serverIn80Tcp10_1_1_0 = new SecurityRuleBuilder().setUuid(new Uuid("9dbb533d-d9b2-4dc9-bae7-ee60c8df184d"))
                 .setTenantId(new Uuid(tenant))
                 .setEthertype(EthertypeV4.class)
-                .setProtocol(ProtocolTcp.class)
+                .setProtocol(protocolTcp)
                 .setPortRangeMin(80)
                 .setPortRangeMax(80)
                 .setDirection(DirectionIngress.class)
                 .setSecurityGroupId(new Uuid(serverSecGrp))
                 .setRemoteIpPrefix(new IpPrefix(new Ipv4Prefix("10.1.1.0/24")))
                 .build();
-        SecurityRule serverInIp20_1_1_0 = new SecurityRuleBuilder().setId(new Uuid("adf7e558-de47-4f9e-a9b8-96e19db5d1ac"))
+        SecurityRule serverInIp20_1_1_0 = new SecurityRuleBuilder().setUuid(new Uuid("adf7e558-de47-4f9e-a9b8-96e19db5d1ac"))
                 .setTenantId(new Uuid(tenant))
                 .setEthertype(EthertypeV4.class)
                 .setDirection(DirectionIngress.class)
@@ -101,27 +103,27 @@ public class NeutronSecurityRuleAwareDataStoreTest extends NeutronMapperDataBrok
             .get();
         assertTrue(potentialTenant.isPresent());
         Optional<Contract> potentialContract = rwTx.read(LogicalDatastoreType.CONFIGURATION,
-                IidFactory.contractIid(tenantId, new ContractId(goldInIpv4.getId().getValue()))).get();
+                IidFactory.contractIid(tenantId, new ContractId(goldInIpv4.getUuid().getValue()))).get();
         assertTrue(potentialContract.isPresent());
         Contract contract = potentialContract.get();
         PolicyAssert.assertContract(contract, goldInIpv4);
         potentialContract = rwTx.read(LogicalDatastoreType.CONFIGURATION,
-                IidFactory.contractIid(tenantId, new ContractId(goldOutIpv4.getId().getValue()))).get();
+                IidFactory.contractIid(tenantId, new ContractId(goldOutIpv4.getUuid().getValue()))).get();
         assertTrue(potentialContract.isPresent());
         contract = potentialContract.get();
         PolicyAssert.assertContract(contract, goldOutIpv4);
         potentialContract = rwTx.read(LogicalDatastoreType.CONFIGURATION,
-                IidFactory.contractIid(tenantId, new ContractId(serverOutIpv4.getId().getValue()))).get();
+                IidFactory.contractIid(tenantId, new ContractId(serverOutIpv4.getUuid().getValue()))).get();
         assertTrue(potentialContract.isPresent());
         contract = potentialContract.get();
         PolicyAssert.assertContract(contract, serverOutIpv4);
         potentialContract = rwTx.read(LogicalDatastoreType.CONFIGURATION,
-                IidFactory.contractIid(tenantId, new ContractId(serverIn80Tcp10_1_1_0.getId().getValue()))).get();
+                IidFactory.contractIid(tenantId, new ContractId(serverIn80Tcp10_1_1_0.getUuid().getValue()))).get();
         assertTrue(potentialContract.isPresent());
         contract = potentialContract.get();
         PolicyAssert.assertContractWithEic(contract, serverIn80Tcp10_1_1_0);
         potentialContract = rwTx.read(LogicalDatastoreType.CONFIGURATION,
-                IidFactory.contractIid(tenantId, new ContractId(serverInIp20_1_1_0.getId().getValue()))).get();
+                IidFactory.contractIid(tenantId, new ContractId(serverInIp20_1_1_0.getUuid().getValue()))).get();
         assertTrue(potentialContract.isPresent());
         contract = potentialContract.get();
         PolicyAssert.assertContractWithEic(contract, serverInIp20_1_1_0);
@@ -131,19 +133,19 @@ public class NeutronSecurityRuleAwareDataStoreTest extends NeutronMapperDataBrok
         EndpointGroup epg = potentialEpg.get();
         PolicyAssert.assertConsumerNamedSelectors(
                 epg,
-                ImmutableSet.of(new ContractId(goldInIpv4.getId().getValue()),
-                        new ContractId(goldOutIpv4.getId().getValue()),
-                        new ContractId(serverIn80Tcp10_1_1_0.getId().getValue()),
-                        new ContractId(serverInIp20_1_1_0.getId().getValue()),
-                        new ContractId(serverOutIpv4.getId().getValue())));
+                ImmutableSet.of(new ContractId(goldInIpv4.getUuid().getValue()),
+                        new ContractId(goldOutIpv4.getUuid().getValue()),
+                        new ContractId(serverIn80Tcp10_1_1_0.getUuid().getValue()),
+                        new ContractId(serverInIp20_1_1_0.getUuid().getValue()),
+                        new ContractId(serverOutIpv4.getUuid().getValue())));
         potentialEpg = rwTx.read(LogicalDatastoreType.CONFIGURATION,
                 IidFactory.endpointGroupIid(tenantId, new EndpointGroupId(serverSecGrp))).get();
         assertTrue(potentialEpg.isPresent());
         epg = potentialEpg.get();
         PolicyAssert.assertConsumerNamedSelectors(epg, ImmutableSet.of(
-                new ContractId(serverIn80Tcp10_1_1_0.getId().getValue()),
-                new ContractId(serverInIp20_1_1_0.getId().getValue()),
-                new ContractId(goldInIpv4.getId().getValue())));
+                new ContractId(serverIn80Tcp10_1_1_0.getUuid().getValue()),
+                new ContractId(serverInIp20_1_1_0.getUuid().getValue()),
+                new ContractId(goldInIpv4.getUuid().getValue())));
     }
 
     @Test
@@ -281,22 +283,22 @@ public class NeutronSecurityRuleAwareDataStoreTest extends NeutronMapperDataBrok
         ruleAware.addNeutronSecurityRule(serverInIpv4, neutron, rwTx);
         TenantId tenantId = new TenantId(tenant);
         Optional<Contract> potentialContract = rwTx.read(LogicalDatastoreType.CONFIGURATION,
-                IidFactory.contractIid(tenantId, new ContractId(goldInIpv4.getId().getValue()))).get();
+                IidFactory.contractIid(tenantId, new ContractId(goldInIpv4.getUuid().getValue()))).get();
         assertTrue(potentialContract.isPresent());
         Contract contract = potentialContract.get();
         PolicyAssert.assertContract(contract, goldInIpv4);
         potentialContract = rwTx.read(LogicalDatastoreType.CONFIGURATION,
-                IidFactory.contractIid(tenantId, new ContractId(goldOutIpv4.getId().getValue()))).get();
+                IidFactory.contractIid(tenantId, new ContractId(goldOutIpv4.getUuid().getValue()))).get();
         assertTrue(potentialContract.isPresent());
         contract = potentialContract.get();
         PolicyAssert.assertContract(contract, goldOutIpv4);
         potentialContract = rwTx.read(LogicalDatastoreType.CONFIGURATION,
-                IidFactory.contractIid(tenantId, new ContractId(serverOutIpv4.getId().getValue()))).get();
+                IidFactory.contractIid(tenantId, new ContractId(serverOutIpv4.getUuid().getValue()))).get();
         assertTrue(potentialContract.isPresent());
         contract = potentialContract.get();
         PolicyAssert.assertContract(contract, serverOutIpv4);
         potentialContract = rwTx.read(LogicalDatastoreType.CONFIGURATION,
-                IidFactory.contractIid(tenantId, new ContractId(serverInIpv4.getId().getValue()))).get();
+                IidFactory.contractIid(tenantId, new ContractId(serverInIpv4.getUuid().getValue()))).get();
         assertTrue(potentialContract.isPresent());
         contract = potentialContract.get();
         PolicyAssert.assertContract(contract, serverInIpv4);
@@ -306,19 +308,19 @@ public class NeutronSecurityRuleAwareDataStoreTest extends NeutronMapperDataBrok
         EndpointGroup epg = potentialEpg.get();
         PolicyAssert.assertConsumerNamedSelectors(
                 epg,
-                ImmutableSet.of(new ContractId(goldInIpv4.getId().getValue()),
-                        new ContractId(goldOutIpv4.getId().getValue()),
-                        new ContractId(serverOutIpv4.getId().getValue()),
-                        new ContractId(serverInIpv4.getId().getValue())));
+                ImmutableSet.of(new ContractId(goldInIpv4.getUuid().getValue()),
+                        new ContractId(goldOutIpv4.getUuid().getValue()),
+                        new ContractId(serverOutIpv4.getUuid().getValue()),
+                        new ContractId(serverInIpv4.getUuid().getValue())));
         potentialEpg = rwTx.read(LogicalDatastoreType.CONFIGURATION,
                 IidFactory.endpointGroupIid(tenantId, new EndpointGroupId(serverSecGrp))).get();
         assertTrue(potentialEpg.isPresent());
         PolicyAssert.assertConsumerNamedSelectors(
                 epg,
-                ImmutableSet.of(new ContractId(goldInIpv4.getId().getValue()),
-                        new ContractId(goldOutIpv4.getId().getValue()),
-                        new ContractId(serverOutIpv4.getId().getValue()),
-                        new ContractId(serverInIpv4.getId().getValue())));
+                ImmutableSet.of(new ContractId(goldInIpv4.getUuid().getValue()),
+                        new ContractId(goldOutIpv4.getUuid().getValue()),
+                        new ContractId(serverOutIpv4.getUuid().getValue()),
+                        new ContractId(serverInIpv4.getUuid().getValue())));
     }
 
     @Test
@@ -335,10 +337,11 @@ public class NeutronSecurityRuleAwareDataStoreTest extends NeutronMapperDataBrok
         SecurityRule serverOutIpv4 = NeutronEntityFactory.securityRuleWithEtherType(
                 "8b9c48d3-44a8-46be-be35-6f3237d98071", tenant, EthertypeV4.class, DirectionEgress.class, serverSecGrp,
                 null);
-        SecurityRule serverIn80TcpIpv4 = new SecurityRuleBuilder().setId(new Uuid("adf7e558-de47-4f9e-a9b8-96e19db5d1ac"))
+        SecurityRuleAttributes.Protocol protocolTcp = new SecurityRuleAttributes.Protocol(ProtocolTcp.class);
+        SecurityRule serverIn80TcpIpv4 = new SecurityRuleBuilder().setUuid(new Uuid("adf7e558-de47-4f9e-a9b8-96e19db5d1ac"))
                 .setTenantId(new Uuid(tenant))
                 .setEthertype(EthertypeV4.class)
-                .setProtocol(ProtocolTcp.class)
+                .setProtocol(protocolTcp)
                 .setPortRangeMin(80)
                 .setPortRangeMax(80)
                 .setDirection(DirectionIngress.class)
@@ -361,22 +364,22 @@ public class NeutronSecurityRuleAwareDataStoreTest extends NeutronMapperDataBrok
         ruleAware.addNeutronSecurityRule(serverIn80TcpIpv4, neutron, rwTx);
         TenantId tenantId = new TenantId(tenant);
         Optional<Contract> potentialContract = rwTx.read(LogicalDatastoreType.CONFIGURATION,
-                IidFactory.contractIid(tenantId, new ContractId(goldInIpv4.getId().getValue()))).get();
+                IidFactory.contractIid(tenantId, new ContractId(goldInIpv4.getUuid().getValue()))).get();
         assertTrue(potentialContract.isPresent());
         Contract contract = potentialContract.get();
         PolicyAssert.assertContract(contract, goldInIpv4);
         potentialContract = rwTx.read(LogicalDatastoreType.CONFIGURATION,
-                IidFactory.contractIid(tenantId, new ContractId(goldOutIpv4.getId().getValue()))).get();
+                IidFactory.contractIid(tenantId, new ContractId(goldOutIpv4.getUuid().getValue()))).get();
         assertTrue(potentialContract.isPresent());
         contract = potentialContract.get();
         PolicyAssert.assertContract(contract, goldOutIpv4);
         potentialContract = rwTx.read(LogicalDatastoreType.CONFIGURATION,
-                IidFactory.contractIid(tenantId, new ContractId(serverOutIpv4.getId().getValue()))).get();
+                IidFactory.contractIid(tenantId, new ContractId(serverOutIpv4.getUuid().getValue()))).get();
         assertTrue(potentialContract.isPresent());
         contract = potentialContract.get();
         PolicyAssert.assertContract(contract, serverOutIpv4);
         potentialContract = rwTx.read(LogicalDatastoreType.CONFIGURATION,
-                IidFactory.contractIid(tenantId, new ContractId(serverIn80TcpIpv4.getId().getValue()))).get();
+                IidFactory.contractIid(tenantId, new ContractId(serverIn80TcpIpv4.getUuid().getValue()))).get();
         assertTrue(potentialContract.isPresent());
         contract = potentialContract.get();
         PolicyAssert.assertContract(contract, serverIn80TcpIpv4);
@@ -386,18 +389,18 @@ public class NeutronSecurityRuleAwareDataStoreTest extends NeutronMapperDataBrok
         EndpointGroup epg = potentialEpg.get();
         PolicyAssert.assertConsumerNamedSelectors(
                 epg,
-                ImmutableSet.of(new ContractId(goldInIpv4.getId().getValue()),
-                        new ContractId(goldOutIpv4.getId().getValue()),
-                        new ContractId(serverOutIpv4.getId().getValue()),
-                        new ContractId(serverIn80TcpIpv4.getId().getValue())));
+                ImmutableSet.of(new ContractId(goldInIpv4.getUuid().getValue()),
+                        new ContractId(goldOutIpv4.getUuid().getValue()),
+                        new ContractId(serverOutIpv4.getUuid().getValue()),
+                        new ContractId(serverIn80TcpIpv4.getUuid().getValue())));
         potentialEpg = rwTx.read(LogicalDatastoreType.CONFIGURATION,
                 IidFactory.endpointGroupIid(tenantId, new EndpointGroupId(serverSecGrp))).get();
         assertTrue(potentialEpg.isPresent());
         epg = potentialEpg.get();
         PolicyAssert.assertConsumerNamedSelectors(
                 epg,
-                ImmutableSet.of(new ContractId(goldInIpv4.getId().getValue()),
-                        new ContractId(serverIn80TcpIpv4.getId().getValue())));
+                ImmutableSet.of(new ContractId(goldInIpv4.getUuid().getValue()),
+                        new ContractId(serverIn80TcpIpv4.getUuid().getValue())));
     }
 
     @Test
@@ -429,22 +432,22 @@ public class NeutronSecurityRuleAwareDataStoreTest extends NeutronMapperDataBrok
         ruleAware.addNeutronSecurityRule(defaultOutIpv6, neutron, rwTx);
         TenantId tenantId = new TenantId(tenant);
         Optional<Contract> potentialContract = rwTx.read(LogicalDatastoreType.CONFIGURATION,
-                IidFactory.contractIid(tenantId, new ContractId(defaultInIpv4Default.getId().getValue()))).get();
+                IidFactory.contractIid(tenantId, new ContractId(defaultInIpv4Default.getUuid().getValue()))).get();
         assertTrue(potentialContract.isPresent());
         Contract contract = potentialContract.get();
         PolicyAssert.assertContract(contract, defaultInIpv4Default);
         potentialContract = rwTx.read(LogicalDatastoreType.CONFIGURATION,
-                IidFactory.contractIid(tenantId, new ContractId(defaultInIpv6Default.getId().getValue()))).get();
+                IidFactory.contractIid(tenantId, new ContractId(defaultInIpv6Default.getUuid().getValue()))).get();
         assertTrue(potentialContract.isPresent());
         contract = potentialContract.get();
         PolicyAssert.assertContract(contract, defaultInIpv6Default);
         potentialContract = rwTx.read(LogicalDatastoreType.CONFIGURATION,
-                IidFactory.contractIid(tenantId, new ContractId(defaultOutIpv4.getId().getValue()))).get();
+                IidFactory.contractIid(tenantId, new ContractId(defaultOutIpv4.getUuid().getValue()))).get();
         assertTrue(potentialContract.isPresent());
         contract = potentialContract.get();
         PolicyAssert.assertContract(contract, defaultOutIpv4);
         potentialContract = rwTx.read(LogicalDatastoreType.CONFIGURATION,
-                IidFactory.contractIid(tenantId, new ContractId(defaultOutIpv6.getId().getValue()))).get();
+                IidFactory.contractIid(tenantId, new ContractId(defaultOutIpv6.getUuid().getValue()))).get();
         assertTrue(potentialContract.isPresent());
         contract = potentialContract.get();
         PolicyAssert.assertContract(contract, defaultOutIpv6);
index d824e8a5e050338f4fa5fb6ff558fdf184cc17fe..93ead3bec93376df14ecfc823f260bfcbd170a68 100644 (file)
@@ -24,6 +24,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.constants.rev150712
 import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.constants.rev150712.ProtocolTcp;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.rev150712.Neutron;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.rev150712.NeutronBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.secgroups.rev150712.SecurityRuleAttributes;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.secgroups.rev150712.security.groups.attributes.SecurityGroupsBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.secgroups.rev150712.security.groups.attributes.security.groups.SecurityGroup;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.secgroups.rev150712.security.rules.attributes.security.rules.SecurityRule;
@@ -84,13 +85,14 @@ public class NeutronSecurityRuleAwareTest extends NeutronMapperDataBrokerTest {
 
     // create neutron security rule
     private SecurityRule buildNeutronSecurityRule() {
-        return new SecurityRuleBuilder().setId(new Uuid(RULE_ID))
+        SecurityRuleAttributes.Protocol protocolTcp = new SecurityRuleAttributes.Protocol(ProtocolTcp.class);
+        return new SecurityRuleBuilder().setUuid(new Uuid(RULE_ID))
             .setTenantId(new Uuid(RULE_TENANT_ID))
             .setSecurityGroupId(new Uuid(RULE_GROUP_ID))
             .setRemoteIpPrefix(new IpPrefix(new Ipv4Prefix("192.0.0.1/24")))
             .setPortRangeMin(1000)
             .setPortRangeMax(5000)
-            .setProtocol(ProtocolTcp.class)
+            .setProtocol(protocolTcp)
             .setEthertype(EthertypeV4.class)
             .setDirection(DirectionIngress.class)
             .build();
index 6d5e50d512c438d51b7d245f0f3d88fbbc0a623b..9d98ec36c5981529e525e46fe3bd212ff88a0e97 100644 (file)
@@ -42,6 +42,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.constants.rev150712
 import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.constants.rev150712.ProtocolIcmp;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.constants.rev150712.ProtocolTcp;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.constants.rev150712.ProtocolUdp;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.secgroups.rev150712.SecurityRuleAttributes;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.secgroups.rev150712.security.rules.attributes.security.rules.SecurityRule;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.secgroups.rev150712.security.rules.attributes.security.rules.SecurityRuleBuilder;
 
@@ -54,7 +55,7 @@ public class SecRuleEntityDecoderTest {
 
     @Before
     public void setUp() throws Exception {
-        secRuleBuilder = new SecurityRuleBuilder().setId(new Uuid("01234567-abcd-ef01-0123-0123456789ab"));
+        secRuleBuilder = new SecurityRuleBuilder().setUuid(new Uuid("01234567-abcd-ef01-0123-0123456789ab"));
     }
 
     @Test
@@ -86,7 +87,8 @@ public class SecRuleEntityDecoderTest {
     @Test
     public final void testGetClassifierInstance_EthertypeAndProtocol() {
         secRuleBuilder.setEthertype(EthertypeV4.class);
-        secRuleBuilder.setProtocol(ProtocolTcp.class);
+        SecurityRuleAttributes.Protocol protocolTcp = new SecurityRuleAttributes.Protocol(ProtocolTcp.class);
+        secRuleBuilder.setProtocol(protocolTcp);
         ClassifierInstance ci = SecRuleEntityDecoder.getClassifierInstance(secRuleBuilder.build());
         Assert.assertEquals(IpProtoClassifierDefinition.DEFINITION.getId(), ci.getClassifierDefinitionId());
         // name is ip_proto_tcp__ether_type_IPv4
@@ -124,7 +126,8 @@ public class SecRuleEntityDecoderTest {
     @Test
     public final void testGetClassifierInstance_EthertypeAndProtocolAndPort() {
         secRuleBuilder.setEthertype(EthertypeV4.class);
-        secRuleBuilder.setProtocol(ProtocolTcp.class);
+        SecurityRuleAttributes.Protocol protocolTcp = new SecurityRuleAttributes.Protocol(ProtocolTcp.class);
+        secRuleBuilder.setProtocol(protocolTcp);
         secRuleBuilder.setPortRangeMin(5);
         secRuleBuilder.setPortRangeMax(5);
         ClassifierInstance ci = SecRuleEntityDecoder.getClassifierInstance(secRuleBuilder.build());
@@ -184,7 +187,8 @@ public class SecRuleEntityDecoderTest {
     @Test
     public final void testGetClassifierInstance_EthertypeAndProtocolAndPorts() {
         secRuleBuilder.setEthertype(EthertypeV4.class);
-        secRuleBuilder.setProtocol(ProtocolTcp.class);
+        SecurityRuleAttributes.Protocol protocolTcp = new SecurityRuleAttributes.Protocol(ProtocolTcp.class);
+        secRuleBuilder.setProtocol(protocolTcp);
         secRuleBuilder.setPortRangeMin(5);
         secRuleBuilder.setPortRangeMax(10);
         ClassifierInstance ci = SecRuleEntityDecoder.getClassifierInstance(secRuleBuilder.build());
@@ -335,14 +339,16 @@ public class SecRuleEntityDecoderTest {
 
     @Test
     public void testIsProtocolOfOneWithinTwo_oneProtocolTcpTwoProtocolTcp() {
-        SecurityRule one = secRuleBuilder.setProtocol(ProtocolTcp.class).build();
-        SecurityRule two = secRuleBuilder.setProtocol(ProtocolTcp.class).build();
+        SecurityRuleAttributes.Protocol protocolTcp = new SecurityRuleAttributes.Protocol(ProtocolTcp.class);
+        SecurityRule one = secRuleBuilder.setProtocol(protocolTcp).build();
+        SecurityRule two = secRuleBuilder.setProtocol(protocolTcp).build();
         assertTrue(SecRuleEntityDecoder.isProtocolOfOneWithinTwo(one, two));
     }
 
     @Test
     public void testIsProtocolOfOneWithinTwo_oneProtocolTcpTwoProtocolNull() {
-        SecurityRule one = secRuleBuilder.setProtocol(ProtocolTcp.class).build();
+        SecurityRuleAttributes.Protocol protocolTcp = new SecurityRuleAttributes.Protocol(ProtocolTcp.class);
+        SecurityRule one = secRuleBuilder.setProtocol(protocolTcp).build();
         SecurityRule two = secRuleBuilder.setProtocol(null).build();
         assertTrue(SecRuleEntityDecoder.isProtocolOfOneWithinTwo(one, two));
     }
@@ -356,15 +362,18 @@ public class SecRuleEntityDecoderTest {
 
     @Test
     public void testIsProtocolOfOneWithinTwo_oneProtocolTcpTwoProtocolUdp() {
-        SecurityRule one = secRuleBuilder.setProtocol(ProtocolTcp.class).build();
-        SecurityRule two = secRuleBuilder.setProtocol(ProtocolUdp.class).build();
+        SecurityRuleAttributes.Protocol protocolTcp = new SecurityRuleAttributes.Protocol(ProtocolTcp.class);
+        SecurityRule one = secRuleBuilder.setProtocol(protocolTcp).build();
+        SecurityRuleAttributes.Protocol protocolUdp = new SecurityRuleAttributes.Protocol(ProtocolUdp.class);
+        SecurityRule two = secRuleBuilder.setProtocol(protocolUdp).build();
         assertFalse(SecRuleEntityDecoder.isProtocolOfOneWithinTwo(one, two));
     }
 
     @Test
     public void testIsProtocolOfOneWithinTwo_oneProtocolNullTwoProtocolTcp() {
         SecurityRule one = secRuleBuilder.setProtocol(null).build();
-        SecurityRule two = secRuleBuilder.setProtocol(ProtocolTcp.class).build();
+        SecurityRuleAttributes.Protocol protocolTcp = new SecurityRuleAttributes.Protocol(ProtocolTcp.class);
+        SecurityRule two = secRuleBuilder.setProtocol(protocolTcp).build();
         assertFalse(SecRuleEntityDecoder.isProtocolOfOneWithinTwo(one, two));
     }
 
@@ -458,19 +467,22 @@ public class SecRuleEntityDecoderTest {
 
     @Test
     public final void testGetProtocol_protoTcp() {
-        secRuleBuilder.setProtocol(ProtocolTcp.class);
+        SecurityRuleAttributes.Protocol protocolTcp = new SecurityRuleAttributes.Protocol(ProtocolTcp.class);
+        secRuleBuilder.setProtocol(protocolTcp);
         Assert.assertEquals(IpProtoClassifierDefinition.TCP_VALUE, SecRuleEntityDecoder.getProtocol(secRuleBuilder.build()));
     }
 
     @Test
     public final void testGetProtocol_protoUdp() {
-        secRuleBuilder.setProtocol(ProtocolUdp.class);
+        SecurityRuleAttributes.Protocol protocolUdp = new SecurityRuleAttributes.Protocol(ProtocolUdp.class);
+        secRuleBuilder.setProtocol(protocolUdp);
         Assert.assertEquals(IpProtoClassifierDefinition.UDP_VALUE, SecRuleEntityDecoder.getProtocol(secRuleBuilder.build()));
     }
 
     @Test
     public final void testGetProtocol_protoIcmp() {
-        secRuleBuilder.setProtocol(ProtocolIcmp.class);
+        SecurityRuleAttributes.Protocol protocolIcmp = new SecurityRuleAttributes.Protocol(ProtocolIcmp.class);
+        secRuleBuilder.setProtocol(protocolIcmp);
         Assert.assertEquals(IpProtoClassifierDefinition.ICMP_VALUE, SecRuleEntityDecoder.getProtocol(secRuleBuilder.build()));
     }
 
@@ -482,7 +494,8 @@ public class SecRuleEntityDecoderTest {
 
     @Test
     public final void testGetProtocol_protoUnknown() {
-        secRuleBuilder.setProtocol(UnknownProtocol.class);
+        SecurityRuleAttributes.Protocol protocolUnknown = new SecurityRuleAttributes.Protocol(UnknownProtocol.class);
+        secRuleBuilder.setProtocol(protocolUnknown);
         thrown.expect(IllegalArgumentException.class);
         SecRuleEntityDecoder.getProtocol(secRuleBuilder.build());
     }
index 482d283afa57d3369c223aed919bfcaf96171c41..6e77ba096633687eb64b28b782a14fcedd43f52e 100644 (file)
@@ -17,6 +17,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.policy.rev
 import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.constants.rev150712.DirectionIngress;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.constants.rev150712.EthertypeV4;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.constants.rev150712.ProtocolTcp;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.secgroups.rev150712.SecurityRuleAttributes;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.secgroups.rev150712.security.rules.attributes.security.rules.SecurityRuleBuilder;
 
 public class SecRuleNameDecoderTest {
@@ -25,7 +26,7 @@ public class SecRuleNameDecoderTest {
 
     @Before
     public void setUp() throws Exception {
-        secRule = new SecurityRuleBuilder().setId(new Uuid("01234567-abcd-ef01-0123-0123456789ab"));
+        secRule = new SecurityRuleBuilder().setUuid(new Uuid("01234567-abcd-ef01-0123-0123456789ab"));
     }
 
     @Test
@@ -45,7 +46,8 @@ public class SecRuleNameDecoderTest {
     public final void testGetClassifierInstanceName() {
         secRule.setDirection(DirectionIngress.class);
         secRule.setEthertype(EthertypeV4.class);
-        secRule.setProtocol(ProtocolTcp.class);
+        SecurityRuleAttributes.Protocol protocolTcp = new SecurityRuleAttributes.Protocol(ProtocolTcp.class);
+        secRule.setProtocol(protocolTcp);
         secRule.setPortRangeMin(8010);
         secRule.setPortRangeMax(8020);
         StringBuilder frmtBuilder = new StringBuilder();
@@ -66,7 +68,7 @@ public class SecRuleNameDecoderTest {
             .append(EtherTypeClassifierDefinition.DEFINITION.getName().getValue())
             .append(MappingUtils.NAME_VALUE_DELIMETER)
             .append("%s");
-        String frmtClsfName = String.format(frmtBuilder.toString(), 8010, 8020, secRule.getProtocol().getSimpleName(),
+        String frmtClsfName = String.format(frmtBuilder.toString(), 8010, 8020, secRule.getProtocol().getIdentityref().getSimpleName(),
                 secRule.getEthertype().getSimpleName());
         ClassifierName expectedClsfInstanceName = new ClassifierName(frmtClsfName);
         assertEquals(expectedClsfInstanceName, SecRuleNameDecoder.getClassifierInstanceName(secRule.build()));
index b4f3392b6a9e8b47183f0a5e98eb8adbc6d9e383..69418b0f65abd7e0afa8cedbba499c47d14a4fce 100644 (file)
@@ -4,6 +4,7 @@ import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.
 import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.constants.rev150712.DirectionBase;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.constants.rev150712.EthertypeBase;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.constants.rev150712.ProtocolBase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.secgroups.rev150712.SecurityRuleAttributes;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.secgroups.rev150712.security.groups.attributes.security.groups.SecurityGroup;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.secgroups.rev150712.security.groups.attributes.security.groups.SecurityGroupBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.secgroups.rev150712.security.rules.attributes.security.rules.SecurityRule;
@@ -27,12 +28,13 @@ public final class NeutronEntityFactory {
 
     public static SecurityRule securityRuleWithoutGroupIds(String id, String tenant, Class<? extends EthertypeBase> etherType,
             Class<? extends DirectionBase> direction, Class<? extends ProtocolBase> protocol, int portMin, int portMax) {
+        SecurityRuleAttributes.Protocol proto = new SecurityRuleAttributes.Protocol(protocol);
         SecurityRuleBuilder secRule = new SecurityRuleBuilder();
-        secRule.setId(new Uuid(id));
+        secRule.setUuid(new Uuid(id));
         secRule.setTenantId(new Uuid(tenant));
         secRule.setEthertype(etherType);
         secRule.setDirection(direction);
-        secRule.setProtocol(protocol);
+        secRule.setProtocol(proto);
         secRule.setPortRangeMin(portMin);
         secRule.setPortRangeMax(portMax);
         return secRule.build();
@@ -41,7 +43,7 @@ public final class NeutronEntityFactory {
     public static SecurityRule securityRuleWithEtherType(String id, String tenant,
             Class<? extends EthertypeBase> etherType, Class<? extends DirectionBase> direction, String ownerGroupId,
             String remoteGroupId) {
-        SecurityRuleBuilder securityRuleBuilder = new SecurityRuleBuilder().setId(new Uuid(id))
+        SecurityRuleBuilder securityRuleBuilder = new SecurityRuleBuilder().setUuid(new Uuid(id))
             .setTenantId(new Uuid(tenant))
             .setEthertype(etherType)
             .setDirection(direction)
index 8cece96194a6284d15f7b811195b32e46d6c5a4c..570a57d8ac1d85a8364dbc2b0a78958e64b292f0 100644 (file)
@@ -86,7 +86,7 @@ public final class PolicyAssert {
     }
 
     public static void assertContractWithEic(Contract contract, SecurityRule secRule) {
-        assertEquals(new ContractId(secRule.getId().getValue()), contract.getId());
+        assertEquals(new ContractId(secRule.getUuid().getValue()), contract.getId());
         assertNull(contract.getQuality());
         assertNull(contract.getTarget());
         assertOneClauseWithEicWithOneSubject(contract, secRule);
@@ -110,7 +110,7 @@ public final class PolicyAssert {
     }
 
     public static void assertContract(Contract contract, SecurityRule secRule) {
-        assertEquals(new ContractId(secRule.getId().getValue()), contract.getId());
+        assertEquals(new ContractId(secRule.getUuid().getValue()), contract.getId());
         assertNull(contract.getQuality());
         assertNull(contract.getTarget());
         assertOneClauseWithOneSubject(contract, secRule);
index 3159e24302c8b412afa7778fc617ef982feadd4f..4cd23267b0213d66f154b43c3b5df18e485d76ab 100644 (file)
       <artifactId>neutron-mapper</artifactId>
       <version>${project.version}</version>
     </dependency>
-    <dependency>
-      <groupId>org.opendaylight.neutron</groupId>
-      <artifactId>neutron-spi</artifactId>
-      <version>${neutron.version}</version>
-    </dependency>
     <dependency>
       <groupId>org.opendaylight.groupbasedpolicy</groupId>
       <artifactId>vpp-renderer</artifactId>
@@ -88,4 +83,4 @@
       </plugin>
     </plugins>
   </build>
-</project>
\ No newline at end of file
+</project>