Refactor Ipv6Service module. 96/72796/13
authorSomashekar Byrappa <somashekar.b@altencalsoftlabs.com>
Fri, 8 Jun 2018 13:43:36 +0000 (19:13 +0530)
committerSridhar Gaddam <sgaddam@redhat.com>
Wed, 4 Jul 2018 10:30:20 +0000 (10:30 +0000)
+ IPv6 generic/common functionality has been moved from Ipv6Service
  module to ipv6util module (Genius) in patch [1].
+ This patch handles removing of the corresponding code in Ipv6Service
  module.
+ VpnManager dependency on Ipv6Service has been updated to refer to
  ipv6util (Genius).

Depends-On: https://git.opendaylight.org/gerrit/#/c/72068/

JIRA: NETVIRT-1213

[1] https://git.opendaylight.org/gerrit/#/c/72794/

Change-Id: I01a90ed11ef90c2416a175e3ab92875bc76f1661
Signed-off-by: Somashekar Byrappa <somashekar.b@altencalsoftlabs.com>
25 files changed:
ipv6service/api/pom.xml
ipv6service/api/src/main/yang/ipv6-ndutil.yang [deleted file]
ipv6service/api/src/main/yang/neighbor-discovery.yang [deleted file]
ipv6service/impl/pom.xml
ipv6service/impl/src/main/java/org/opendaylight/netvirt/ipv6service/IfMgr.java
ipv6service/impl/src/main/java/org/opendaylight/netvirt/ipv6service/Ipv6NdUtilServiceImpl.java [deleted file]
ipv6service/impl/src/main/java/org/opendaylight/netvirt/ipv6service/Ipv6NeighborSolicitation.java [deleted file]
ipv6service/impl/src/main/java/org/opendaylight/netvirt/ipv6service/Ipv6PktHandler.java
ipv6service/impl/src/main/java/org/opendaylight/netvirt/ipv6service/Ipv6RouterAdvt.java
ipv6service/impl/src/main/java/org/opendaylight/netvirt/ipv6service/Ipv6ServiceInterfaceEventListener.java
ipv6service/impl/src/main/java/org/opendaylight/netvirt/ipv6service/NeutronPortChangeListener.java
ipv6service/impl/src/main/java/org/opendaylight/netvirt/ipv6service/NeutronSubnetChangeListener.java
ipv6service/impl/src/main/java/org/opendaylight/netvirt/ipv6service/VirtualNetwork.java
ipv6service/impl/src/main/java/org/opendaylight/netvirt/ipv6service/VirtualPort.java
ipv6service/impl/src/main/java/org/opendaylight/netvirt/ipv6service/utils/Ipv6ServiceConstants.java [moved from ipv6service/impl/src/main/java/org/opendaylight/netvirt/ipv6service/utils/Ipv6Constants.java with 55% similarity]
ipv6service/impl/src/main/java/org/opendaylight/netvirt/ipv6service/utils/Ipv6ServiceUtils.java
ipv6service/impl/src/main/resources/org/opendaylight/blueprint/ipv6service.xml
ipv6service/impl/src/test/java/org/opendaylight/netvirt/ipv6service/Ipv6NeighborSolicitationTest.java [deleted file]
ipv6service/impl/src/test/java/org/opendaylight/netvirt/ipv6service/Ipv6PktHandlerTest.java
ipv6service/impl/src/test/java/org/opendaylight/netvirt/ipv6service/utils/Ipv6ServiceUtilsTest.java
vpnmanager/impl/pom.xml
vpnmanager/impl/src/main/java/org/opendaylight/netvirt/vpnmanager/SubnetRoutePacketInHandler.java
vpnmanager/impl/src/main/java/org/opendaylight/netvirt/vpnmanager/VpnUtil.java
vpnmanager/impl/src/main/java/org/opendaylight/netvirt/vpnmanager/iplearn/Ipv6NaNotificationHandler.java
vpnmanager/impl/src/main/resources/org/opendaylight/blueprint/vpnmanager.xml

index 98058d6b997817db7f992ccc5a14e6f985fb9386..da30f6f4c16b484580c30ddc2bc056b514451bd6 100644 (file)
@@ -26,10 +26,6 @@ and is available at http://www.eclipse.org/legal/epl-v10.html
             <groupId>org.opendaylight.mdsal.model</groupId>
             <artifactId>ietf-inet-types-2013-07-15</artifactId>
         </dependency>
-        <dependency>
-            <groupId>org.opendaylight.mdsal.model</groupId>
-            <artifactId>ietf-interfaces</artifactId>
-        </dependency>
         <dependency>
             <groupId>org.opendaylight.mdsal.model</groupId>
             <artifactId>ietf-yang-types-20130715</artifactId>
diff --git a/ipv6service/api/src/main/yang/ipv6-ndutil.yang b/ipv6service/api/src/main/yang/ipv6-ndutil.yang
deleted file mode 100644 (file)
index be4616c..0000000
+++ /dev/null
@@ -1,107 +0,0 @@
-module ipv6-ndutil {
-    yang-version 1;
-    namespace "urn:opendaylight:netvirt:ipv6service:ipv6util";
-    prefix "ipv6-ndutil";
-
-    import ietf-interfaces {
-        prefix if;
-    }
-
-    import ietf-inet-types {
-        prefix inet; revision-date 2013-07-15;
-    }
-
-    import ietf-yang-types {
-        prefix yang;
-    }
-
-    revision "2017-02-10" {
-        description "IPv6 Neighbor Discovery Util module";
-    }
-
-
-    grouping interfaces {
-        list interface-address {
-           key interface;
-           leaf interface {
-                type leafref {
-                    path "/if:interfaces/if:interface/if:name";
-                }
-           }
-           leaf src-ip-address {
-                type inet:ipv6-address;
-           }
-           leaf src-mac-address {
-                type yang:phys-address;
-            }
-        }
-    }
-
-
-    rpc send-neighbor-solicitation {
-        input {
-            leaf target-ip-address {
-                type inet:ipv6-address;
-            }
-            uses interfaces;
-        }
-    }
-
-    rpc send-neighbor-solicitation-to-of-group {
-        input {
-            leaf source-ipv6 {
-                type inet:ipv6-address;
-                mandatory "true";
-            }
-            leaf target-ip-address {
-                type inet:ipv6-address;
-                mandatory "true";
-            }
-            leaf source-ll-address {
-               type yang:mac-address;
-               mandatory "true";
-            }
-            leaf dp-id {
-               type uint64;
-               mandatory "true";
-            }
-            leaf of-group-id {
-               type uint32;
-               mandatory "true";
-               description "NS will be sent to the specified OpenFlow group ID.";
-            }
-        }
-    }
-
-    notification na-received {
-        leaf source-mac {
-            type yang:mac-address;
-        }
-        leaf destination-mac {
-            type yang:mac-address;
-        }
-        leaf source-ipv6 {
-            type inet:ipv6-address;
-        }
-        leaf destination-ipv6 {
-            type inet:ipv6-address;
-        }
-        leaf target-address {
-            type inet:ipv6-address;
-        }
-        leaf target-ll-address {
-            type yang:mac-address;
-        }
-        leaf of-table-id {
-            type uint32;
-        }
-        leaf metadata {
-            type uint64;
-        }
-        leaf interface {
-            type leafref {
-                path "/if:interfaces/if:interface/if:name";
-            }
-        }
-    }
-}
diff --git a/ipv6service/api/src/main/yang/neighbor-discovery.yang b/ipv6service/api/src/main/yang/neighbor-discovery.yang
deleted file mode 100644 (file)
index d1cf5a7..0000000
+++ /dev/null
@@ -1,194 +0,0 @@
-/*
-Copyright (c) 2016 Dell Inc. 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
-*/
-
-module neighbor-discovery {
-    yang-version 1;
-    namespace "urn:opendaylight:netvirt:ipv6service:nd:packet";
-    prefix nd;
-
-    import ietf-yang-types {prefix yang; revision-date "2013-07-15";}
-    import ietf-inet-types { prefix inet; revision-date 2013-07-15; }
-
-    revision 2016-06-20 { description "ND informational message packets"; }
-
-    grouping ethernet-header {
-        leaf source-mac {
-            type yang:mac-address;
-        }
-        leaf destination-mac {
-            type yang:mac-address;
-        }
-        leaf ethertype {
-            type uint16;
-        }
-    }
-
-    grouping ipv6-header {
-        leaf version {
-            type uint8;
-        }
-        leaf flow-label {
-            type uint32;
-        }
-        leaf ipv6-length {
-            type uint16;
-        }
-        leaf next-header {
-            type uint8;
-        }
-        leaf hop-limit {
-            type uint8;
-        }
-        leaf source-ipv6 {
-            type inet:ipv6-address;
-        }
-        leaf destination-ipv6 {
-            type inet:ipv6-address;
-        }
-    }
-
-    grouping icmp6-header {
-        leaf icmp6-type {
-            type uint8;
-        }
-        leaf icmp6-code {
-            type uint8;
-        }
-        leaf icmp6-chksum {
-            type uint16;
-        }
-    }
-
-    container neighbor-solicitation-packet {
-        uses ethernet-header;
-        uses ipv6-header;
-        uses icmp6-header;
-        leaf reserved {
-            type uint32;
-        }
-        leaf target-ip-address {
-            type inet:ipv6-address;
-        }
-        leaf option-type {
-            type uint8;
-        }
-        leaf source-addr-length {
-            type uint8;
-        }
-        leaf source-ll-address {
-            type yang:mac-address;
-        }
-    }
-
-    container neighbor-advertise-packet {
-        uses ethernet-header;
-        uses ipv6-header;
-        uses icmp6-header;
-        leaf flags {
-            type uint32;
-        }
-        leaf target-address {
-            type inet:ipv6-address;
-        }
-        leaf option-type {
-            type uint8;
-        }
-        leaf target-addr-length {
-            type uint8;
-        }
-        leaf target-ll-address {
-            type yang:mac-address;
-        }
-    }
-
-    container router-solicitation-packet {
-        uses ethernet-header;
-        uses ipv6-header;
-        uses icmp6-header;
-        leaf reserved {
-            type uint32;
-        }
-        leaf option-type {
-            type uint8;
-        }
-        leaf source-addr-length {
-            type uint8;
-        }
-        leaf source-ll-address {
-            type yang:mac-address;
-        }
-    }
-
-    container router-advertisement-packet {
-        uses ethernet-header;
-        uses ipv6-header;
-        uses icmp6-header;
-        leaf cur-hop-limit {
-            type uint8;
-        }
-        leaf flags {
-            type uint8;
-        }
-        leaf router-lifetime {
-            type uint16;
-        }
-        leaf reachable-time {
-            type uint32;
-        }
-        leaf retrans-time {
-            type uint32;
-        }
-
-        leaf option-source-addr {
-            type uint8;
-        }
-        leaf source-addr-length {
-            type uint8;
-        }
-        leaf source-ll-address {
-            type yang:mac-address;
-        }
-
-        leaf option-mtu {
-            type uint8;
-        }
-        leaf option-mtu-length {
-            type uint8;
-        }
-        leaf mtu {
-            type yang:mac-address;
-        }
-        list prefix-list {
-            key "prefix";
-            leaf option-type {
-                type uint8;
-            }
-            leaf option-length {
-                type uint8;
-            }
-            leaf prefix-length {
-                type uint8;
-            }
-            leaf flags {
-                type uint8;
-            }
-            leaf valid-lifetime {
-                type uint32;
-            }
-            leaf preferred-lifetime {
-                type uint32;
-            }
-            leaf reserved {
-                type uint32;
-            }
-            leaf prefix {
-                type inet:ipv6-prefix;
-            }
-        }
-    }
-}
index d4ff8adfb3b7d7bd26a4ea27f89ba75371d72eda..2f83864b6df2b9c453a5a1d2242e0aa918df7187 100644 (file)
@@ -40,6 +40,11 @@ and is available at http://www.eclipse.org/legal/epl-v10.html
             <artifactId>mdsalutil-api</artifactId>
             <version>${genius.version}</version>
         </dependency>
+        <dependency>
+            <groupId>org.opendaylight.genius</groupId>
+            <artifactId>ipv6util-api</artifactId>
+            <version>${genius.version}</version>
+        </dependency>
         <dependency>
             <groupId>${project.groupId}</groupId>
             <artifactId>elanmanager-api</artifactId>
index 8bb25d13b6fc304012642afe3c30596545b85067..b62b182281c2140ab48c7e4321bf914d84441f89 100644 (file)
@@ -27,6 +27,8 @@ import javax.annotation.PreDestroy;
 import javax.inject.Inject;
 import javax.inject.Singleton;
 import org.opendaylight.controller.md.sal.binding.api.DataBroker;
+import org.opendaylight.genius.ipv6util.api.Ipv6Constants.Ipv6RouterAdvertisementType;
+import org.opendaylight.genius.ipv6util.api.Ipv6Util;
 import org.opendaylight.genius.mdsalutil.MDSALUtil;
 import org.opendaylight.genius.mdsalutil.NwConstants;
 import org.opendaylight.netvirt.elanmanager.api.IElanService;
@@ -35,9 +37,8 @@ import org.opendaylight.netvirt.ipv6service.api.IVirtualNetwork;
 import org.opendaylight.netvirt.ipv6service.api.IVirtualPort;
 import org.opendaylight.netvirt.ipv6service.api.IVirtualRouter;
 import org.opendaylight.netvirt.ipv6service.api.IVirtualSubnet;
-import org.opendaylight.netvirt.ipv6service.utils.Ipv6Constants;
-import org.opendaylight.netvirt.ipv6service.utils.Ipv6Constants.Ipv6RtrAdvertType;
 import org.opendaylight.netvirt.ipv6service.utils.Ipv6PeriodicTrQueue;
+import org.opendaylight.netvirt.ipv6service.utils.Ipv6ServiceConstants;
 import org.opendaylight.netvirt.ipv6service.utils.Ipv6ServiceUtils;
 import org.opendaylight.netvirt.ipv6service.utils.Ipv6TimerWheel;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress;
@@ -243,15 +244,15 @@ public class IfMgr implements ElementCache, AutoCloseable {
         if (prevIntf == null) {
             newIntf = true;
             MacAddress ifaceMac = MacAddress.getDefaultInstance(macAddress);
-            Ipv6Address llAddr = ipv6ServiceUtils.getIpv6LinkLocalAddressFromMac(ifaceMac);
+            Ipv6Address llAddr = Ipv6Util.getIpv6LinkLocalAddressFromMac(ifaceMac);
             /* A new router interface is created. This is basically triggered when an
             IPv6 subnet is associated to the router. Check if network is already hosting
             any VMs. If so, on all the hosts that have VMs on the network, program the
             icmpv6 punt flows in IPV6_TABLE(45).
              */
-            programIcmpv6RSPuntFlows(intf.getNetworkID(), Ipv6Constants.ADD_FLOW);
-            programIcmpv6NSPuntFlowForAddress(intf.getNetworkID(), llAddr, Ipv6Constants.ADD_FLOW);
-            programIcmpv6NaForwardFlows(intf, snetId, Ipv6Constants.ADD_FLOW);
+            programIcmpv6RSPuntFlows(intf.getNetworkID(), Ipv6ServiceConstants.ADD_FLOW);
+            programIcmpv6NSPuntFlowForAddress(intf.getNetworkID(), llAddr, Ipv6ServiceConstants.ADD_FLOW);
+            programIcmpv6NaForwardFlows(intf, snetId, Ipv6ServiceConstants.ADD_FLOW);
         } else {
             intf = prevIntf;
             intf.setSubnetInfo(snetId, fixedIp);
@@ -276,8 +277,8 @@ public class IfMgr implements ElementCache, AutoCloseable {
             vrouterv6IntfMap.put(networkId, intf);
         }
 
-        programIcmpv6NSPuntFlowForAddress(intf.getNetworkID(), fixedIp.getIpv6Address(), Ipv6Constants.ADD_FLOW);
-        programIcmpv6NaPuntFlow(networkId, intf.getSubnets(), Ipv6Constants.ADD_FLOW);
+        programIcmpv6NSPuntFlowForAddress(intf.getNetworkID(), fixedIp.getIpv6Address(), Ipv6ServiceConstants.ADD_FLOW);
+        programIcmpv6NaPuntFlow(networkId, intf.getSubnets(), Ipv6ServiceConstants.ADD_FLOW);
 
         if (newIntf) {
             LOG.debug("start the periodic RA Timer for routerIntf {}", portId);
@@ -335,8 +336,9 @@ public class IfMgr implements ElementCache, AutoCloseable {
          */
         for (FixedIps ips : deletedIps) {
             VirtualSubnet snet = getSubnet(ips.getSubnetId());
-            programIcmpv6NaPuntFlow(networkID, Lists.newArrayList(snet), Ipv6Constants.DEL_FLOW);
-            programIcmpv6NSPuntFlowForAddress(networkID, ips.getIpAddress().getIpv6Address(), Ipv6Constants.DEL_FLOW);
+            programIcmpv6NaPuntFlow(networkID, Lists.newArrayList(snet), Ipv6ServiceConstants.DEL_FLOW);
+            programIcmpv6NSPuntFlowForAddress(networkID, ips.getIpAddress().getIpv6Address(),
+                    Ipv6ServiceConstants.DEL_FLOW);
         }
     }
 
@@ -429,7 +431,7 @@ public class IfMgr implements ElementCache, AutoCloseable {
             // Update the network <--> List[dpnIds, List<ports>] cache.
             VirtualNetwork vnet = getNetwork(intf.getNetworkID());
             if (null != vnet) {
-                vnet.updateDpnPortInfo(dpId, ofPort, Ipv6Constants.ADD_ENTRY);
+                vnet.updateDpnPortInfo(dpId, ofPort, Ipv6ServiceConstants.ADD_ENTRY);
             } else {
                 LOG.error("In updateDpnInfo networks NOT FOUND: networkID {}, portId {}, dpId {}, ofPort {}",
                            intf.getNetworkID(), portId, dpId, ofPort);
@@ -453,7 +455,7 @@ public class IfMgr implements ElementCache, AutoCloseable {
         List<String> ofportIds = interfaceState.getLowerLayerIf();
         NodeConnectorId nodeConnectorId = new NodeConnectorId(ofportIds.get(0));
         BigInteger dpId = ipv6ServiceUtils.getDpIdFromInterfaceState(interfaceState);
-        if (!dpId.equals(Ipv6Constants.INVALID_DPID)) {
+        if (!dpId.equals(Ipv6ServiceConstants.INVALID_DPID)) {
             Long ofPort = MDSALUtil.getOfPortNumberFromPortName(nodeConnectorId);
             updateDpnInfo(portId, dpId, ofPort);
         }
@@ -465,7 +467,7 @@ public class IfMgr implements ElementCache, AutoCloseable {
         if (intf != null) {
             intf.removeSelf();
             Uuid networkID = intf.getNetworkID();
-            if (intf.getDeviceOwner().equalsIgnoreCase(Ipv6Constants.NETWORK_ROUTER_INTERFACE)) {
+            if (intf.getDeviceOwner().equalsIgnoreCase(Ipv6ServiceConstants.NETWORK_ROUTER_INTERFACE)) {
                 LOG.info("In removePort for router interface, portId {}", portId);
 
                 if (networkID != null) {
@@ -475,15 +477,15 @@ public class IfMgr implements ElementCache, AutoCloseable {
                 /* Router port is deleted. Remove the corresponding icmpv6 punt flows on all
                 the dpnIds which were hosting the VMs on the network.
                  */
-                programIcmpv6RSPuntFlows(intf.getNetworkID(), Ipv6Constants.DEL_FLOW);
-                programIcmpv6NaPuntFlow(networkID, intf.getSubnets(), Ipv6Constants.DEL_FLOW);
+                programIcmpv6RSPuntFlows(intf.getNetworkID(), Ipv6ServiceConstants.DEL_FLOW);
+                programIcmpv6NaPuntFlow(networkID, intf.getSubnets(), Ipv6ServiceConstants.DEL_FLOW);
                 for (Ipv6Address ipv6Address: intf.getIpv6Addresses()) {
-                    programIcmpv6NSPuntFlowForAddress(intf.getNetworkID(), ipv6Address, Ipv6Constants.DEL_FLOW);
+                    programIcmpv6NSPuntFlowForAddress(intf.getNetworkID(), ipv6Address, Ipv6ServiceConstants.DEL_FLOW);
                 }
                 for (VirtualSubnet subnet : intf.getSubnets()) {
-                    programIcmpv6NaForwardFlows(intf, subnet.getSubnetUUID(), Ipv6Constants.DEL_FLOW);
+                    programIcmpv6NaForwardFlows(intf, subnet.getSubnetUUID(), Ipv6ServiceConstants.DEL_FLOW);
                 }
-                transmitRouterAdvertisement(intf, Ipv6RtrAdvertType.CEASE_ADVERTISEMENT);
+                transmitRouterAdvertisement(intf, Ipv6RouterAdvertisementType.CEASE_ADVERTISEMENT);
                 timer.cancelPeriodicTransmissionTimeout(intf.getPeriodicTimeout());
                 intf.resetPeriodicTimeout();
                 LOG.debug("Reset the periodic RA Timer for intf {}", intf.getIntfUUID());
@@ -495,7 +497,7 @@ public class IfMgr implements ElementCache, AutoCloseable {
                 VirtualNetwork vnet = getNetwork(networkID);
                 if (null != vnet) {
                     BigInteger dpId = intf.getDpId();
-                    vnet.updateDpnPortInfo(dpId, intf.getOfPort(), Ipv6Constants.DEL_ENTRY);
+                    vnet.updateDpnPortInfo(dpId, intf.getOfPort(), Ipv6ServiceConstants.DEL_ENTRY);
                 }
             }
         }
@@ -534,10 +536,10 @@ public class IfMgr implements ElementCache, AutoCloseable {
                                       Uuid id, Ipv6Address ipv6Address,
                                       Integer action) {
         Set<Ipv6Address> ipv6AddressesList = unprocessed.get(id);
-        if (action == Ipv6Constants.ADD_FLOW) {
+        if (action == Ipv6ServiceConstants.ADD_FLOW) {
             unprocessed.computeIfAbsent(id, key -> Collections.synchronizedSet(ConcurrentHashMap.newKeySet()))
                     .add(ipv6Address);
-        } else if (action == Ipv6Constants.DEL_FLOW) {
+        } else if (action == Ipv6ServiceConstants.DEL_FLOW) {
             if ((ipv6AddressesList != null) && (ipv6AddressesList.contains(ipv6Address))) {
                 ipv6AddressesList.remove(ipv6Address);
             }
@@ -561,7 +563,7 @@ public class IfMgr implements ElementCache, AutoCloseable {
             return null;
         }
         for (VirtualSubnet snet : intf.getSubnets()) {
-            if (snet.getIpVersion().equals(Ipv6Constants.IP_VERSION_V6)) {
+            if (snet.getIpVersion().equals(Ipv6ServiceConstants.IP_VERSION_V6)) {
                 return intf;
             }
         }
@@ -581,14 +583,16 @@ public class IfMgr implements ElementCache, AutoCloseable {
             List<BigInteger> dpnList = vnet.getDpnsHostingNetwork();
             for (BigInteger dpId : dpnList) {
                 flowStatus = vnet.getRSPuntFlowStatusOnDpnId(dpId);
-                if (action == Ipv6Constants.ADD_FLOW && flowStatus == Ipv6Constants.FLOWS_NOT_CONFIGURED) {
+                if (action == Ipv6ServiceConstants.ADD_FLOW
+                        && flowStatus == Ipv6ServiceConstants.FLOWS_NOT_CONFIGURED) {
                     ipv6ServiceUtils.installIcmpv6RsPuntFlow(NwConstants.IPV6_TABLE, dpId, elanTag,
-                            Ipv6Constants.ADD_FLOW);
-                    vnet.setRSPuntFlowStatusOnDpnId(dpId, Ipv6Constants.FLOWS_CONFIGURED);
-                } else if (action == Ipv6Constants.DEL_FLOW && flowStatus == Ipv6Constants.FLOWS_CONFIGURED) {
+                            Ipv6ServiceConstants.ADD_FLOW);
+                    vnet.setRSPuntFlowStatusOnDpnId(dpId, Ipv6ServiceConstants.FLOWS_CONFIGURED);
+                } else if (action == Ipv6ServiceConstants.DEL_FLOW
+                        && flowStatus == Ipv6ServiceConstants.FLOWS_CONFIGURED) {
                     ipv6ServiceUtils.installIcmpv6RsPuntFlow(NwConstants.IPV6_TABLE, dpId, elanTag,
-                            Ipv6Constants.DEL_FLOW);
-                    vnet.setRSPuntFlowStatusOnDpnId(dpId, Ipv6Constants.FLOWS_NOT_CONFIGURED);
+                            Ipv6ServiceConstants.DEL_FLOW);
+                    vnet.setRSPuntFlowStatusOnDpnId(dpId, Ipv6ServiceConstants.FLOWS_NOT_CONFIGURED);
                 }
             }
         } else {
@@ -607,15 +611,16 @@ public class IfMgr implements ElementCache, AutoCloseable {
         if (vnet != null) {
             Collection<VirtualNetwork.DpnInterfaceInfo> dpnIfaceList = vnet.getDpnIfaceList();
             for (VirtualNetwork.DpnInterfaceInfo dpnIfaceInfo : dpnIfaceList) {
-                if (action == Ipv6Constants.ADD_FLOW && !dpnIfaceInfo.isNdTargetFlowAlreadyConfigured(ipv6Address)
+                if (action == Ipv6ServiceConstants.ADD_FLOW
+                        && !dpnIfaceInfo.isNdTargetFlowAlreadyConfigured(ipv6Address)
                         && dpnIfaceInfo.getDpId() != null) {
                     ipv6ServiceUtils.installIcmpv6NsPuntFlow(NwConstants.IPV6_TABLE, dpnIfaceInfo.getDpId(), elanTag,
-                            ipv6Address.getValue(), Ipv6Constants.ADD_FLOW);
+                            ipv6Address.getValue(), Ipv6ServiceConstants.ADD_FLOW);
                     dpnIfaceInfo.updateNDTargetAddress(ipv6Address, action);
-                } else if (action == Ipv6Constants.DEL_FLOW
+                } else if (action == Ipv6ServiceConstants.DEL_FLOW
                         && dpnIfaceInfo.isNdTargetFlowAlreadyConfigured(ipv6Address)) {
                     ipv6ServiceUtils.installIcmpv6NsPuntFlow(NwConstants.IPV6_TABLE, dpnIfaceInfo.getDpId(), elanTag,
-                            ipv6Address.getValue(), Ipv6Constants.DEL_FLOW);
+                            ipv6Address.getValue(), Ipv6ServiceConstants.DEL_FLOW);
                     dpnIfaceInfo.updateNDTargetAddress(ipv6Address, action);
                 }
             }
@@ -640,12 +645,12 @@ public class IfMgr implements ElementCache, AutoCloseable {
                 for (VirtualSubnet subnet : subnets) {
                     Ipv6Prefix ipv6SubnetPrefix = subnet.getSubnetCidr().getIpv6Prefix();
                     if (ipv6SubnetPrefix != null) {
-                        if (action == Ipv6Constants.ADD_FLOW
+                        if (action == Ipv6ServiceConstants.ADD_FLOW
                                 && !dpnIfaceInfo.isSubnetCidrFlowAlreadyConfigured(subnet.getSubnetUUID())) {
                             ipv6ServiceUtils.installIcmpv6NaPuntFlow(NwConstants.IPV6_TABLE, ipv6SubnetPrefix,
                                     dpnIfaceInfo.getDpId(), elanTag, action);
                             dpnIfaceInfo.updateSubnetCidrFlowStatus(subnet.getSubnetUUID(), action);
-                        } else if (action == Ipv6Constants.DEL_FLOW
+                        } else if (action == Ipv6ServiceConstants.DEL_FLOW
                                 && dpnIfaceInfo.isSubnetCidrFlowAlreadyConfigured(subnet.getSubnetUUID())) {
                             ipv6ServiceUtils.installIcmpv6NaPuntFlow(NwConstants.IPV6_TABLE, ipv6SubnetPrefix,
                                     dpnIfaceInfo.getDpId(), elanTag, action);
@@ -659,7 +664,7 @@ public class IfMgr implements ElementCache, AutoCloseable {
 
     public void handleInterfaceStateEvent(IVirtualPort port, BigInteger dpId, VirtualPort routerPort, int addOrRemove) {
         Long elanTag = getNetworkElanTag(port.getNetworkID());
-        if (addOrRemove == Ipv6Constants.ADD_FLOW && routerPort != null) {
+        if (addOrRemove == Ipv6ServiceConstants.ADD_FLOW && routerPort != null) {
             // Check and program icmpv6 punt flows on the dpnID if its the first VM on the host.
             programIcmpv6PuntFlows(port, dpId, elanTag, routerPort);
         }
@@ -671,17 +676,17 @@ public class IfMgr implements ElementCache, AutoCloseable {
         if (null != vnet) {
             VirtualNetwork.DpnInterfaceInfo dpnInfo = vnet.getDpnIfaceInfo(dpId);
             if (null != dpnInfo) {
-                if (vnet.getRSPuntFlowStatusOnDpnId(dpId) == Ipv6Constants.FLOWS_NOT_CONFIGURED) {
+                if (vnet.getRSPuntFlowStatusOnDpnId(dpId) == Ipv6ServiceConstants.FLOWS_NOT_CONFIGURED) {
                     ipv6ServiceUtils.installIcmpv6RsPuntFlow(NwConstants.IPV6_TABLE, dpId, elanTag,
-                            Ipv6Constants.ADD_FLOW);
-                    vnet.setRSPuntFlowStatusOnDpnId(dpId, Ipv6Constants.FLOWS_CONFIGURED);
+                            Ipv6ServiceConstants.ADD_FLOW);
+                    vnet.setRSPuntFlowStatusOnDpnId(dpId, Ipv6ServiceConstants.FLOWS_CONFIGURED);
                 }
 
                 for (Ipv6Address ipv6Address : routerPort.getIpv6Addresses()) {
                     if (!dpnInfo.isNdTargetFlowAlreadyConfigured(ipv6Address)) {
                         ipv6ServiceUtils.installIcmpv6NsPuntFlow(NwConstants.IPV6_TABLE, dpId,
-                                elanTag, ipv6Address.getValue(), Ipv6Constants.ADD_FLOW);
-                        dpnInfo.updateNDTargetAddress(ipv6Address, Ipv6Constants.ADD_FLOW);
+                                elanTag, ipv6Address.getValue(), Ipv6ServiceConstants.ADD_FLOW);
+                        dpnInfo.updateNDTargetAddress(ipv6Address, Ipv6ServiceConstants.ADD_FLOW);
                     }
                 }
 
@@ -690,8 +695,8 @@ public class IfMgr implements ElementCache, AutoCloseable {
                     if (ipv6SubnetPrefix != null
                             && !dpnInfo.isSubnetCidrFlowAlreadyConfigured(subnet.getSubnetUUID())) {
                         ipv6ServiceUtils.installIcmpv6NaPuntFlow(NwConstants.IPV6_TABLE, ipv6SubnetPrefix, dpId,
-                                elanTag, Ipv6Constants.ADD_FLOW);
-                        dpnInfo.updateSubnetCidrFlowStatus(subnet.getSubnetUUID(), Ipv6Constants.ADD_FLOW);
+                                elanTag, Ipv6ServiceConstants.ADD_FLOW);
+                        dpnInfo.updateSubnetCidrFlowStatus(subnet.getSubnetUUID(), Ipv6ServiceConstants.ADD_FLOW);
                     }
                 }
             }
@@ -818,7 +823,7 @@ public class IfMgr implements ElementCache, AutoCloseable {
                 removeUnprocessedNSFlows(unprocessedNetNSFlowIntfs, networkId);
 
         for (Ipv6Address ipv6Address : ipv6Addresses) {
-            programIcmpv6NSPuntFlowForAddress(networkId, ipv6Address, Ipv6Constants.ADD_FLOW);
+            programIcmpv6NSPuntFlowForAddress(networkId, ipv6Address, Ipv6ServiceConstants.ADD_FLOW);
         }
 
         Integer action = removeUnprocessedRSFlows(unprocessedNetRSFlowIntfs, networkId);
@@ -831,7 +836,7 @@ public class IfMgr implements ElementCache, AutoCloseable {
         if (null != net && null != net.getNetworkUuid()) {
             /* removing all RS flows when network gets removed, as the DPN-list is maintained only as part of
             * network cache. After removal of network there is no way to remove them today. */
-            programIcmpv6RSPuntFlows(net.getNetworkUuid(), Ipv6Constants.DEL_FLOW);
+            programIcmpv6RSPuntFlows(net.getNetworkUuid(), Ipv6ServiceConstants.DEL_FLOW);
             removeAllIcmpv6NSPuntFlowForNetwork(net.getNetworkUuid());
             net.removeSelf();
         }
@@ -840,7 +845,7 @@ public class IfMgr implements ElementCache, AutoCloseable {
         removeUnprocessedNSFlows(unprocessedNetNSFlowIntfs, networkId);
     }
 
-    private void transmitRouterAdvertisement(VirtualPort intf, Ipv6RtrAdvertType advType) {
+    private void transmitRouterAdvertisement(VirtualPort intf, Ipv6RouterAdvertisementType advType) {
         Ipv6RouterAdvt ipv6RouterAdvert = new Ipv6RouterAdvt(packetService, this);
 
         VirtualNetwork vnet = getNetwork(intf.getNetworkID());
@@ -872,9 +877,9 @@ public class IfMgr implements ElementCache, AutoCloseable {
             for (Ipv6Address ipv6Address : dpnIfaceInfo.ndTargetFlowsPunted) {
                 if (ipv6ServiceEosHandler.isClusterOwner()) {
                     ipv6ServiceUtils.installIcmpv6NsPuntFlow(NwConstants.IPV6_TABLE, dpnIfaceInfo.getDpId(),
-                            elanTag, ipv6Address.getValue(), Ipv6Constants.DEL_FLOW);
+                            elanTag, ipv6Address.getValue(), Ipv6ServiceConstants.DEL_FLOW);
                 }
-                dpnIfaceInfo.updateNDTargetAddress(ipv6Address, Ipv6Constants.DEL_ENTRY);
+                dpnIfaceInfo.updateNDTargetAddress(ipv6Address, Ipv6ServiceConstants.DEL_ENTRY);
             }
         }
     }
@@ -893,14 +898,14 @@ public class IfMgr implements ElementCache, AutoCloseable {
             /* Only the Cluster Owner would be sending out the Periodic RAs.
                However, the timer is configured on all the nodes to handle cluster fail-over scenarios.
              */
-            transmitRouterAdvertisement(port, Ipv6RtrAdvertType.UNSOLICITED_ADVERTISEMENT);
+            transmitRouterAdvertisement(port, Ipv6RouterAdvertisementType.UNSOLICITED_ADVERTISEMENT);
         }
         Timeout portTimeout = timer.setPeriodicTransmissionTimeout(port.getPeriodicTimer(),
-                Ipv6Constants.PERIODIC_RA_INTERVAL,
+                Ipv6ServiceConstants.PERIODIC_RA_INTERVAL,
                 TimeUnit.SECONDS);
         port.setPeriodicTimeout(portTimeout);
         LOG.debug("re-started periodic RA Timer for routerIntf {}, int {}s", port.getIntfUUID(),
-                Ipv6Constants.PERIODIC_RA_INTERVAL);
+                Ipv6ServiceConstants.PERIODIC_RA_INTERVAL);
     }
 
     @Override
diff --git a/ipv6service/impl/src/main/java/org/opendaylight/netvirt/ipv6service/Ipv6NdUtilServiceImpl.java b/ipv6service/impl/src/main/java/org/opendaylight/netvirt/ipv6service/Ipv6NdUtilServiceImpl.java
deleted file mode 100644 (file)
index c05803f..0000000
+++ /dev/null
@@ -1,135 +0,0 @@
-/*
- * Copyright (c) 2017 Red Hat, Inc. 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.netvirt.ipv6service;
-
-import static com.google.common.base.Preconditions.checkArgument;
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import com.google.common.util.concurrent.ListenableFuture;
-import java.math.BigInteger;
-import java.util.concurrent.ExecutionException;
-import java.util.concurrent.Future;
-import javax.inject.Inject;
-import javax.inject.Singleton;
-import org.opendaylight.genius.mdsalutil.MDSALUtil;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6Address;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rpcs.rev160406.GetPortFromInterfaceInputBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rpcs.rev160406.GetPortFromInterfaceOutput;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rpcs.rev160406.OdlInterfaceRpcService;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorRef;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.ipv6service.ipv6util.rev170210.Ipv6NdutilService;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.ipv6service.ipv6util.rev170210.SendNeighborSolicitationInput;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.ipv6service.ipv6util.rev170210.SendNeighborSolicitationOutput;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.ipv6service.ipv6util.rev170210.SendNeighborSolicitationToOfGroupInput;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.ipv6service.ipv6util.rev170210.SendNeighborSolicitationToOfGroupOutput;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.ipv6service.ipv6util.rev170210.interfaces.InterfaceAddress;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.packet.service.rev130709.PacketProcessingService;
-import org.opendaylight.yangtools.yang.common.RpcError;
-import org.opendaylight.yangtools.yang.common.RpcResult;
-import org.opendaylight.yangtools.yang.common.RpcResultBuilder;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-@Singleton
-public class Ipv6NdUtilServiceImpl implements Ipv6NdutilService {
-    private static final Logger LOG = LoggerFactory.getLogger(Ipv6NdUtilServiceImpl.class);
-    private final OdlInterfaceRpcService odlInterfaceRpcService;
-    private final Ipv6NeighborSolicitation ipv6NeighborSolicitation;
-
-    private static final String FAILED_TO_GET_SRC_MAC_FOR_INTERFACE = "Failed to get src mac for interface %s iid %s ";
-    private static final String FAILED_TO_SEND_NS_FOR_INTERFACE = "Failed to send Neighbor Solicitation for interface ";
-    private static final String DPN_NOT_FOUND_ERROR = "dpn not found for interface %s ";
-    private static final String NODE_CONNECTOR_NOT_FOUND_ERROR = "Node connector id not found for interface %s";
-
-    @Inject
-    public Ipv6NdUtilServiceImpl(final OdlInterfaceRpcService odlInterfaceRpcService,
-            final PacketProcessingService packetService) {
-        this.odlInterfaceRpcService = odlInterfaceRpcService;
-        this.ipv6NeighborSolicitation = new Ipv6NeighborSolicitation(packetService);
-    }
-
-    @Override
-    public ListenableFuture<RpcResult<SendNeighborSolicitationOutput>> sendNeighborSolicitation(
-            SendNeighborSolicitationInput ndInput) {
-        RpcResultBuilder<SendNeighborSolicitationOutput> failureBuilder = RpcResultBuilder.failed();
-        RpcResultBuilder<SendNeighborSolicitationOutput> successBuilder = RpcResultBuilder.success();
-        Ipv6Address targetIpv6Address = null;
-        Ipv6Address srcIpv6Address;
-        String interfaceName = null;
-        String macAddr = null;
-        BigInteger dpnId;
-        int localErrorCount = 0;
-
-        targetIpv6Address = ndInput.getTargetIpAddress();
-        for (InterfaceAddress interfaceAddress : ndInput.getInterfaceAddress()) {
-            try {
-                interfaceName = interfaceAddress.getInterface();
-                srcIpv6Address = interfaceAddress.getSrcIpAddress();
-
-                GetPortFromInterfaceOutput portResult = getPortFromInterface(interfaceName);
-                checkNotNull(portResult);
-                dpnId = portResult.getDpid();
-                Long portid = portResult.getPortno();
-                checkArgument(null != dpnId && BigInteger.ZERO != dpnId, DPN_NOT_FOUND_ERROR, interfaceName);
-
-                NodeConnectorRef nodeRef = MDSALUtil.getNodeConnRef(dpnId, portid.toString());
-                checkNotNull(nodeRef, NODE_CONNECTOR_NOT_FOUND_ERROR, interfaceName);
-
-                if (interfaceAddress.getSrcMacAddress() != null) {
-                    macAddr = interfaceAddress.getSrcMacAddress().getValue();
-                }
-                checkNotNull(macAddr, FAILED_TO_GET_SRC_MAC_FOR_INTERFACE, interfaceName, nodeRef.getValue());
-                ipv6NeighborSolicitation.transmitNeighborSolicitation(dpnId, nodeRef, new MacAddress(macAddr),
-                                                                      srcIpv6Address, targetIpv6Address);
-            } catch (NullPointerException | IllegalArgumentException e) {
-                LOG.trace("Failed to send Neighbor Solicitation for {} on interface {}",
-                           ndInput.getTargetIpAddress(), interfaceName);
-                failureBuilder.withError(RpcError.ErrorType.APPLICATION, FAILED_TO_SEND_NS_FOR_INTERFACE
-                        + interfaceName, e);
-                successBuilder.withError(RpcError.ErrorType.APPLICATION, FAILED_TO_SEND_NS_FOR_INTERFACE
-                        + interfaceName, e);
-                localErrorCount++;
-            }
-
-        }
-        if (localErrorCount == ndInput.getInterfaceAddress().size()) {
-            // Failed to send IPv6 Neighbor Solicitation on all the interfaces, return failure.
-            return failureBuilder.buildFuture();
-        }
-
-        return successBuilder.buildFuture();
-    }
-
-    private GetPortFromInterfaceOutput getPortFromInterface(String interfaceName) {
-        GetPortFromInterfaceInputBuilder getPortFromInterfaceInputBuilder = new GetPortFromInterfaceInputBuilder();
-        getPortFromInterfaceInputBuilder.setIntfName(interfaceName);
-        GetPortFromInterfaceOutput result = null;
-
-        Future<RpcResult<GetPortFromInterfaceOutput>> portFromInterface = odlInterfaceRpcService
-                .getPortFromInterface(getPortFromInterfaceInputBuilder.build());
-        try {
-            result = portFromInterface.get().getResult();
-            LOG.trace("getPortFromInterface rpc result is {} ", result);
-        } catch (InterruptedException | ExecutionException e) {
-            LOG.error("Error while retrieving the interfaceName from tag using getInterfaceFromIfIndex RPC");
-        }
-        return result;
-    }
-
-    @Override
-    public ListenableFuture<RpcResult<SendNeighborSolicitationToOfGroupOutput>> sendNeighborSolicitationToOfGroup(
-            SendNeighborSolicitationToOfGroupInput ndInput) {
-        RpcResultBuilder<SendNeighborSolicitationToOfGroupOutput> successBuilder = RpcResultBuilder.success();
-        ipv6NeighborSolicitation.transmitNeighborSolicitationToOfGroup(ndInput.getDpId(), ndInput.getSourceLlAddress(),
-                ndInput.getSourceIpv6(), ndInput.getTargetIpAddress(), ndInput.getOfGroupId());
-
-        return  successBuilder.buildFuture();
-    }
-
-}
diff --git a/ipv6service/impl/src/main/java/org/opendaylight/netvirt/ipv6service/Ipv6NeighborSolicitation.java b/ipv6service/impl/src/main/java/org/opendaylight/netvirt/ipv6service/Ipv6NeighborSolicitation.java
deleted file mode 100644 (file)
index 408a537..0000000
+++ /dev/null
@@ -1,147 +0,0 @@
-/*
- * Copyright (c) 2017 Red Hat, Inc. 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.netvirt.ipv6service;
-
-import java.math.BigInteger;
-import java.net.InetAddress;
-import java.net.UnknownHostException;
-import java.nio.ByteBuffer;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-import org.opendaylight.genius.mdsalutil.ActionInfo;
-import org.opendaylight.genius.mdsalutil.MDSALUtil;
-import org.opendaylight.genius.mdsalutil.NwConstants;
-import org.opendaylight.genius.mdsalutil.actions.ActionGroup;
-import org.opendaylight.infrautils.utils.concurrent.ListenableFutures;
-import org.opendaylight.netvirt.ipv6service.utils.Ipv6Constants;
-import org.opendaylight.netvirt.ipv6service.utils.Ipv6ServiceUtils;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6Address;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorRef;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeId;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeRef;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.Nodes;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeKey;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.ipv6service.nd.packet.rev160620.NeighborSolicitationPacket;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.ipv6service.nd.packet.rev160620.NeighborSolicitationPacketBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.packet.service.rev130709.PacketProcessingService;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.packet.service.rev130709.TransmitPacketInput;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.packet.service.rev130709.TransmitPacketInputBuilder;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class Ipv6NeighborSolicitation {
-
-    private static final Logger LOG = LoggerFactory.getLogger(Ipv6NeighborSolicitation.class);
-
-    private final PacketProcessingService packetService;
-
-    public Ipv6NeighborSolicitation(PacketProcessingService packetService) {
-        this.packetService = packetService;
-    }
-
-    private byte[] frameNeighborSolicitationRequest(MacAddress srcMacAddress, Ipv6Address srcIpv6Address,
-                                                  Ipv6Address targetIpv6Address) {
-        MacAddress macAddress = Ipv6ServiceUtils.getIpv6MulticastMacAddress(targetIpv6Address);
-        Ipv6Address snMcastAddr = Ipv6ServiceUtils.getIpv6SolicitedNodeMcastAddress(targetIpv6Address);
-
-        NeighborSolicitationPacketBuilder nsPacket = new NeighborSolicitationPacketBuilder();
-        nsPacket.setSourceMac(srcMacAddress);
-        nsPacket.setDestinationMac(macAddress);
-        nsPacket.setEthertype(NwConstants.ETHTYPE_IPV6);
-
-        nsPacket.setVersion(Ipv6Constants.IP_VERSION_6);
-        nsPacket.setFlowLabel((long) 0);
-        nsPacket.setIpv6Length(32);
-        nsPacket.setNextHeader(Ipv6Constants.ICMP_V6_TYPE);
-        nsPacket.setHopLimit(Ipv6Constants.ICMP_V6_MAX_HOP_LIMIT);
-        nsPacket.setSourceIpv6(srcIpv6Address);
-        nsPacket.setDestinationIpv6(snMcastAddr);
-
-        nsPacket.setIcmp6Type(Ipv6Constants.ICMP_V6_NS_CODE);
-        nsPacket.setIcmp6Code((short) 0);
-        nsPacket.setIcmp6Chksum(0);
-
-        nsPacket.setReserved((long) 0);
-        nsPacket.setTargetIpAddress(targetIpv6Address);
-        nsPacket.setOptionType(Ipv6Constants.ICMP_V6_OPTION_SOURCE_LLA);
-        nsPacket.setSourceAddrLength((short)1);
-        nsPacket.setSourceLlAddress(srcMacAddress);
-
-        return fillNeighborSolicitationPacket(nsPacket.build());
-    }
-
-    private byte[] icmp6NsPayloadtoByte(NeighborSolicitationPacket pdu) {
-        byte[] data = new byte[36];
-        Arrays.fill(data, (byte)0);
-
-        ByteBuffer buf = ByteBuffer.wrap(data);
-        buf.put((byte)pdu.getIcmp6Type().shortValue());
-        buf.put((byte)pdu.getIcmp6Code().shortValue());
-        buf.putShort((short)pdu.getIcmp6Chksum().intValue());
-        buf.putInt((int)pdu.getReserved().longValue());
-        try {
-            byte[] address = null;
-            address = InetAddress.getByName(pdu.getTargetIpAddress().getValue()).getAddress();
-            buf.put(address);
-        } catch (UnknownHostException e) {
-            LOG.error("Serializing NS target address failed", e);
-        }
-
-        buf.put((byte)pdu.getOptionType().shortValue());
-        buf.put((byte)pdu.getSourceAddrLength().shortValue());
-        buf.put(Ipv6ServiceUtils.bytesFromHexString(pdu.getSourceLlAddress().getValue()));
-        return data;
-    }
-
-    private byte[] fillNeighborSolicitationPacket(NeighborSolicitationPacket pdu) {
-        ByteBuffer buf = ByteBuffer.allocate(Ipv6Constants.ICMPV6_OFFSET + pdu.getIpv6Length());
-
-        buf.put(Ipv6ServiceUtils.convertEthernetHeaderToByte(pdu), 0, 14);
-        buf.put(Ipv6ServiceUtils.convertIpv6HeaderToByte(pdu), 0, 40);
-        buf.put(icmp6NsPayloadtoByte(pdu), 0, pdu.getIpv6Length());
-        int checksum = Ipv6ServiceUtils.calcIcmpv6Checksum(buf.array(), pdu);
-        buf.putShort(Ipv6Constants.ICMPV6_OFFSET + 2, (short)checksum);
-        return buf.array();
-    }
-
-    public boolean transmitNeighborSolicitation(BigInteger dpnId, NodeConnectorRef nodeRef,
-                                                MacAddress srcMacAddress, Ipv6Address srcIpv6Address,
-                                                Ipv6Address targetIpv6Address) {
-        byte[] txPayload = frameNeighborSolicitationRequest(srcMacAddress, srcIpv6Address, targetIpv6Address);
-        NodeConnectorRef nodeConnectorRef = MDSALUtil.getNodeConnRef(dpnId, "0xfffffffd");
-        TransmitPacketInput input = new TransmitPacketInputBuilder().setPayload(txPayload)
-                .setNode(new NodeRef(InstanceIdentifier.builder(Nodes.class)
-                        .child(Node.class, new NodeKey(new NodeId("openflow:" + dpnId))).build()))
-                .setEgress(nodeRef).setIngress(nodeConnectorRef).build();
-
-        // Tx the packet out of the controller.
-        LOG.debug("Transmitting the Neighbor Solicitation packet out on {}", dpnId);
-        ListenableFutures.addErrorLogging(packetService.transmitPacket(input), LOG, "transmitPacket");
-        return true;
-    }
-
-    public void transmitNeighborSolicitationToOfGroup(BigInteger dpId, MacAddress srcMacAddress,
-            Ipv6Address srcIpv6Address, Ipv6Address targetIpv6Address, long ofGroupId) {
-        byte[] txPayload = frameNeighborSolicitationRequest(srcMacAddress, srcIpv6Address, targetIpv6Address);
-        List<ActionInfo> lstActionInfo = new ArrayList<>();
-        lstActionInfo.add(new ActionGroup(ofGroupId));
-
-        TransmitPacketInput input = MDSALUtil.getPacketOutDefault(lstActionInfo, txPayload, dpId);
-        // Tx the packet out of the controller.
-        LOG.debug(
-                "Transmitting Neighbor Solicitation packet out. srcMacAddress={}, srcIpv6Address={}, "
-                        + "targetIpv6Address={}, dpId={}, ofGroupId={}",
-                srcMacAddress.getValue(), srcIpv6Address.getValue(), targetIpv6Address.getValue(), dpId, ofGroupId);
-        ListenableFutures.addErrorLogging(packetService.transmitPacket(input), LOG, "transmitPacket");
-    }
-}
index 0e6eaebad4398afc490bc42ae2f6bedd284a1a96..9642c3fd49654ebc168fc02f5123bf479423c453 100644 (file)
@@ -20,26 +20,30 @@ import javax.annotation.PreDestroy;
 import javax.inject.Inject;
 import javax.inject.Singleton;
 import org.opendaylight.controller.md.sal.binding.api.NotificationPublishService;
+import org.opendaylight.genius.ipv6util.api.Icmpv6Type;
+import org.opendaylight.genius.ipv6util.api.Ipv6Constants;
+import org.opendaylight.genius.ipv6util.api.Ipv6Constants.Ipv6RouterAdvertisementType;
+import org.opendaylight.genius.ipv6util.api.Ipv6Util;
 import org.opendaylight.genius.mdsalutil.MetaDataUtil;
+import org.opendaylight.genius.mdsalutil.NwConstants;
+import org.opendaylight.genius.mdsalutil.packet.IPProtocols;
 import org.opendaylight.infrautils.utils.concurrent.JdkFutures;
-import org.opendaylight.netvirt.ipv6service.utils.Ipv6Constants;
-import org.opendaylight.netvirt.ipv6service.utils.Ipv6Constants.Ipv6RtrAdvertType;
 import org.opendaylight.netvirt.ipv6service.utils.Ipv6ServiceUtils;
 import org.opendaylight.openflowplugin.libraries.liblldp.BitBufferHelper;
 import org.opendaylight.openflowplugin.libraries.liblldp.BufferException;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6Address;
 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.genius.ipv6.nd.packet.rev160620.Ipv6Header;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.ipv6.nd.packet.rev160620.NeighborAdvertisePacket;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.ipv6.nd.packet.rev160620.NeighborAdvertisePacketBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.ipv6.nd.packet.rev160620.NeighborSolicitationPacket;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.ipv6.nd.packet.rev160620.NeighborSolicitationPacketBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.ipv6.nd.packet.rev160620.RouterSolicitationPacket;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.ipv6.nd.packet.rev160620.RouterSolicitationPacketBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.ipv6.nd.util.rev170210.NaReceivedBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeRef;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.ipv6service.ipv6util.rev170210.NaReceivedBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.ipv6service.nd.packet.rev160620.Ipv6Header;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.ipv6service.nd.packet.rev160620.NeighborAdvertisePacket;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.ipv6service.nd.packet.rev160620.NeighborAdvertisePacketBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.ipv6service.nd.packet.rev160620.NeighborSolicitationPacket;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.ipv6service.nd.packet.rev160620.NeighborSolicitationPacketBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.ipv6service.nd.packet.rev160620.RouterSolicitationPacket;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.ipv6service.nd.packet.rev160620.RouterSolicitationPacketBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.packet.service.rev130709.PacketProcessingListener;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.packet.service.rev130709.PacketProcessingService;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.packet.service.rev130709.PacketReceived;
@@ -86,10 +90,10 @@ public class Ipv6PktHandler implements AutoCloseable, PacketProcessingListener {
         try {
             ethType = BitBufferHelper.getInt(BitBufferHelper.getBits(data, Ipv6Constants.ETHTYPE_START,
                     Ipv6Constants.TWO_BYTES));
-            if (ethType == Ipv6Constants.IP_V6_ETHTYPE) {
+            if (ethType == NwConstants.ETHTYPE_IPV6) {
                 v6NxtHdr = BitBufferHelper.getByte(BitBufferHelper.getBits(data,
                         Ipv6Constants.IP_V6_HDR_START + Ipv6Constants.IP_V6_NEXT_HDR, Ipv6Constants.ONE_BYTE));
-                if (v6NxtHdr == Ipv6Constants.ICMP_V6_TYPE) {
+                if (v6NxtHdr == IPProtocols.IPV6ICMP.intValue()) {
                     int icmpv6Type = BitBufferHelper.getInt(BitBufferHelper.getBits(data,
                             Ipv6Constants.ICMPV6_HDR_START, Ipv6Constants.ONE_BYTE));
                     if (isOfInterest(icmpv6Type)) {
@@ -109,8 +113,9 @@ public class Ipv6PktHandler implements AutoCloseable, PacketProcessingListener {
     }
 
     private boolean isOfInterest(int icmpv6Type) {
-        return icmpv6Type == Ipv6Constants.ICMP_V6_RS_CODE || icmpv6Type == Ipv6Constants.ICMP_V6_NS_CODE
-                || icmpv6Type == Ipv6Constants.ICMP_V6_NA_CODE;
+        return icmpv6Type == Icmpv6Type.ROUTER_SOLICITATION.getValue()
+                || icmpv6Type == Icmpv6Type.NEIGHBOR_SOLICITATION.getValue()
+                || icmpv6Type == Icmpv6Type.NEIGHBOR_ADVERTISEMENT.getValue();
     }
 
     public long getPacketProcessedCounter() {
@@ -128,13 +133,13 @@ public class Ipv6PktHandler implements AutoCloseable, PacketProcessingListener {
 
         @Override
         public void run() {
-            if (type == Ipv6Constants.ICMP_V6_NS_CODE) {
+            if (type == Icmpv6Type.NEIGHBOR_SOLICITATION.getValue()) {
                 LOG.info("Received Neighbor Solicitation request");
                 processNeighborSolicitationRequest();
-            } else if (type == Ipv6Constants.ICMP_V6_RS_CODE) {
+            } else if (type == Icmpv6Type.ROUTER_SOLICITATION.getValue()) {
                 LOG.info("Received Router Solicitation request");
                 processRouterSolicitationRequest();
-            } else if (type == Ipv6Constants.ICMP_V6_NA_CODE) {
+            } else if (type == Icmpv6Type.NEIGHBOR_ADVERTISEMENT.getValue()) {
                 LOG.trace("Received Neighbor Advertisement packet");
                 processNeighborAdvertisementPacket();
             }
@@ -144,7 +149,7 @@ public class Ipv6PktHandler implements AutoCloseable, PacketProcessingListener {
             byte[] data = packet.getPayload();
             NeighborSolicitationPacket nsPdu = deserializeNSPacket(data);
             Ipv6Header ipv6Header = nsPdu;
-            if (Ipv6ServiceUtils.validateChecksum(data, ipv6Header, nsPdu.getIcmp6Chksum()) == false) {
+            if (Ipv6Util.validateChecksum(data, ipv6Header, nsPdu.getIcmp6Chksum()) == false) {
                 pktProccessedCounter.incrementAndGet();
                 LOG.warn("Received Neighbor Solicitation with invalid checksum on {}. Ignoring the packet.",
                         packet.getIngress());
@@ -199,10 +204,10 @@ public class Ipv6PktHandler implements AutoCloseable, PacketProcessingListener {
 
             try {
                 nsPdu.setDestinationMac(new MacAddress(
-                        Ipv6ServiceUtils.bytesToHexString(BitBufferHelper.getBits(data, bitOffset, 48))));
+                        Ipv6Util.bytesToHexString(BitBufferHelper.getBits(data, bitOffset, 48))));
                 bitOffset = bitOffset + 48;
                 nsPdu.setSourceMac(new MacAddress(
-                        Ipv6ServiceUtils.bytesToHexString(BitBufferHelper.getBits(data, bitOffset, 48))));
+                        Ipv6Util.bytesToHexString(BitBufferHelper.getBits(data, bitOffset, 48))));
                 bitOffset = bitOffset + 48;
                 nsPdu.setEthertype(BitBufferHelper.getInt(BitBufferHelper.getBits(data, bitOffset, 16)));
 
@@ -255,7 +260,7 @@ public class Ipv6PktHandler implements AutoCloseable, PacketProcessingListener {
             naPacket.setSourceIpv6(pdu.getTargetIpAddress());
             naPacket.setSourceMac(new MacAddress(port.getMacAddress()));
             naPacket.setHopLimit(Ipv6Constants.ICMP_V6_MAX_HOP_LIMIT);
-            naPacket.setIcmp6Type(Ipv6Constants.ICMP_V6_NA_CODE);
+            naPacket.setIcmp6Type(Icmpv6Type.NEIGHBOR_ADVERTISEMENT.getValue());
             naPacket.setIcmp6Code(pdu.getIcmp6Code());
             flag = flag << 24;
             naPacket.setFlags(flag);
@@ -289,17 +294,17 @@ public class Ipv6PktHandler implements AutoCloseable, PacketProcessingListener {
             }
             buf.put((byte)pdu.getOptionType().shortValue());
             buf.put((byte)pdu.getTargetAddrLength().shortValue());
-            buf.put(Ipv6ServiceUtils.bytesFromHexString(pdu.getTargetLlAddress().getValue()));
+            buf.put(Ipv6Util.bytesFromHexString(pdu.getTargetLlAddress().getValue()));
             return data;
         }
 
         private byte[] fillNeighborAdvertisementPacket(NeighborAdvertisePacket pdu) {
             ByteBuffer buf = ByteBuffer.allocate(Ipv6Constants.ICMPV6_OFFSET + pdu.getIpv6Length());
 
-            buf.put(Ipv6ServiceUtils.convertEthernetHeaderToByte(pdu), 0, 14);
-            buf.put(Ipv6ServiceUtils.convertIpv6HeaderToByte(pdu), 0, 40);
+            buf.put(Ipv6Util.convertEthernetHeaderToByte(pdu), 0, 14);
+            buf.put(Ipv6Util.convertIpv6HeaderToByte(pdu), 0, 40);
             buf.put(icmp6NAPayloadtoByte(pdu), 0, pdu.getIpv6Length());
-            int checksum = Ipv6ServiceUtils.calcIcmpv6Checksum(buf.array(), pdu);
+            int checksum = Ipv6Util.calculateIcmpv6Checksum(buf.array(), pdu);
             buf.putShort(Ipv6Constants.ICMPV6_OFFSET + 2, (short)checksum);
             return buf.array();
         }
@@ -308,7 +313,7 @@ public class Ipv6PktHandler implements AutoCloseable, PacketProcessingListener {
             byte[] data = packet.getPayload();
             RouterSolicitationPacket rsPdu = deserializeRSPacket(data);
             Ipv6Header ipv6Header = rsPdu;
-            if (Ipv6ServiceUtils.validateChecksum(data, ipv6Header, rsPdu.getIcmp6Chksum()) == false) {
+            if (Ipv6Util.validateChecksum(data, ipv6Header, rsPdu.getIcmp6Chksum()) == false) {
                 pktProccessedCounter.incrementAndGet();
                 LOG.warn("Received RS packet with invalid checksum on {}. Ignoring the packet.",
                         packet.getIngress());
@@ -335,7 +340,7 @@ public class Ipv6PktHandler implements AutoCloseable, PacketProcessingListener {
             Ipv6RouterAdvt ipv6RouterAdvert = new Ipv6RouterAdvt(pktService, ifMgr);
             LOG.debug("Sending Solicited Router Advertisement for the port {} belongs to the network {}", port,
                     port.getNetworkID());
-            ipv6RouterAdvert.transmitRtrAdvertisement(Ipv6RtrAdvertType.SOLICITED_ADVERTISEMENT,
+            ipv6RouterAdvert.transmitRtrAdvertisement(Ipv6RouterAdvertisementType.SOLICITED_ADVERTISEMENT,
                     routerPort, 0, rsPdu, port.getDpId(), port.getIntfUUID());
             pktProccessedCounter.incrementAndGet();
         }
@@ -346,10 +351,10 @@ public class Ipv6PktHandler implements AutoCloseable, PacketProcessingListener {
 
             try {
                 rsPdu.setDestinationMac(new MacAddress(
-                        Ipv6ServiceUtils.bytesToHexString(BitBufferHelper.getBits(data, bitOffset, 48))));
+                        Ipv6Util.bytesToHexString(BitBufferHelper.getBits(data, bitOffset, 48))));
                 bitOffset = bitOffset + 48;
                 rsPdu.setSourceMac(new MacAddress(
-                        Ipv6ServiceUtils.bytesToHexString(BitBufferHelper.getBits(data, bitOffset, 48))));
+                        Ipv6Util.bytesToHexString(BitBufferHelper.getBits(data, bitOffset, 48))));
                 bitOffset = bitOffset + 48;
                 rsPdu.setEthertype(BitBufferHelper.getInt(BitBufferHelper.getBits(data, bitOffset, 16)));
 
@@ -388,7 +393,7 @@ public class Ipv6PktHandler implements AutoCloseable, PacketProcessingListener {
                     bitOffset = bitOffset + 8;
                     if (rsPdu.getOptionType() == Ipv6Constants.ICMP_V6_OPTION_SOURCE_LLA) {
                         rsPdu.setSourceLlAddress(new MacAddress(
-                                Ipv6ServiceUtils.bytesToHexString(BitBufferHelper.getBits(data, bitOffset, 48))));
+                                Ipv6Util.bytesToHexString(BitBufferHelper.getBits(data, bitOffset, 48))));
                     }
                 }
             } catch (BufferException | UnknownHostException e) {
@@ -407,7 +412,7 @@ public class Ipv6PktHandler implements AutoCloseable, PacketProcessingListener {
                 return;
             }
             Ipv6Header ipv6Header = naPdu;
-            if (Ipv6ServiceUtils.validateChecksum(data, ipv6Header, naPdu.getIcmp6Chksum()) == false) {
+            if (Ipv6Util.validateChecksum(data, ipv6Header, naPdu.getIcmp6Chksum()) == false) {
                 pktProccessedCounter.incrementAndGet();
                 LOG.warn("Received Neighbor Advertisement with invalid checksum on {}. Ignoring the packet.",
                         packet.getIngress());
@@ -432,10 +437,10 @@ public class Ipv6PktHandler implements AutoCloseable, PacketProcessingListener {
             int bitOffset = 0;
 
             naPdu.setDestinationMac(
-                    new MacAddress(Ipv6ServiceUtils.bytesToHexString(BitBufferHelper.getBits(data, bitOffset, 48))));
+                    new MacAddress(Ipv6Util.bytesToHexString(BitBufferHelper.getBits(data, bitOffset, 48))));
             bitOffset = bitOffset + 48;
             naPdu.setSourceMac(
-                    new MacAddress(Ipv6ServiceUtils.bytesToHexString(BitBufferHelper.getBits(data, bitOffset, 48))));
+                    new MacAddress(Ipv6Util.bytesToHexString(BitBufferHelper.getBits(data, bitOffset, 48))));
             bitOffset = bitOffset + 48;
             naPdu.setEthertype(BitBufferHelper.getInt(BitBufferHelper.getBits(data, bitOffset, 16)));
 
@@ -476,7 +481,7 @@ public class Ipv6PktHandler implements AutoCloseable, PacketProcessingListener {
                 bitOffset = bitOffset + 8;
                 if (naPdu.getOptionType() == Ipv6Constants.ICMP_V6_OPTION_TARGET_LLA) {
                     naPdu.setTargetLlAddress(new MacAddress(
-                            Ipv6ServiceUtils.bytesToHexString(BitBufferHelper.getBits(data, bitOffset, 48))));
+                            Ipv6Util.bytesToHexString(BitBufferHelper.getBits(data, bitOffset, 48))));
                 }
             }
             return naPdu.build();
index 37aee2c1b2a0e0d05ba606391cca42363cc9ccf6..ea22d761b5105ec59631fa9995ba16099ea6a58a 100644 (file)
@@ -13,13 +13,17 @@ import java.nio.ByteBuffer;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.List;
-
+import org.opendaylight.genius.ipv6util.api.Icmpv6Type;
+import org.opendaylight.genius.ipv6util.api.Ipv6Constants;
+import org.opendaylight.genius.ipv6util.api.Ipv6Constants.Ipv6RouterAdvertisementType;
+import org.opendaylight.genius.ipv6util.api.Ipv6Util;
 import org.opendaylight.genius.mdsalutil.ActionInfo;
 import org.opendaylight.genius.mdsalutil.MDSALUtil;
+import org.opendaylight.genius.mdsalutil.NwConstants;
 import org.opendaylight.genius.mdsalutil.actions.ActionGroup;
+import org.opendaylight.genius.mdsalutil.packet.IPProtocols;
 import org.opendaylight.infrautils.utils.concurrent.JdkFutures;
-import org.opendaylight.netvirt.ipv6service.utils.Ipv6Constants;
-import org.opendaylight.netvirt.ipv6service.utils.Ipv6Constants.Ipv6RtrAdvertType;
+import org.opendaylight.netvirt.ipv6service.utils.Ipv6ServiceConstants;
 import org.opendaylight.netvirt.ipv6service.utils.Ipv6ServiceUtils;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IetfInetUtil;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress;
@@ -27,11 +31,11 @@ import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.
 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.action.types.rev131112.action.list.Action;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.ipv6service.nd.packet.rev160620.RouterAdvertisementPacket;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.ipv6service.nd.packet.rev160620.RouterAdvertisementPacketBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.ipv6service.nd.packet.rev160620.RouterSolicitationPacket;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.ipv6service.nd.packet.rev160620.router.advertisement.packet.PrefixList;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.ipv6service.nd.packet.rev160620.router.advertisement.packet.PrefixListBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.ipv6.nd.packet.rev160620.RouterAdvertisementPacket;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.ipv6.nd.packet.rev160620.RouterAdvertisementPacketBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.ipv6.nd.packet.rev160620.RouterSolicitationPacket;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.ipv6.nd.packet.rev160620.router.advertisement.packet.PrefixList;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.ipv6.nd.packet.rev160620.router.advertisement.packet.PrefixListBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.packet.service.rev130709.PacketProcessingService;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.packet.service.rev130709.TransmitPacketInput;
 import org.slf4j.Logger;
@@ -48,7 +52,7 @@ public class Ipv6RouterAdvt {
         this.ifMgr = ifMgr;
     }
 
-    public boolean transmitRtrAdvertisement(Ipv6RtrAdvertType raType, VirtualPort routerPort,
+    public boolean transmitRtrAdvertisement(Ipv6RouterAdvertisementType raType, VirtualPort routerPort,
                                             long elanTag, RouterSolicitationPacket rsPdu,
                                             BigInteger dpnId, Uuid port) {
         RouterAdvertisementPacketBuilder raPacket = new RouterAdvertisementPacketBuilder();
@@ -59,7 +63,7 @@ public class Ipv6RouterAdvt {
         /* Send solicited router advertisement to requested VM port only.
          * Send periodic unsolicited router advertisement to ELAN broadcast group.
          */
-        if (raType == Ipv6RtrAdvertType.SOLICITED_ADVERTISEMENT) {
+        if (raType == Ipv6RouterAdvertisementType.SOLICITED_ADVERTISEMENT) {
             List<Action> actions = ifMgr.getEgressAction(port.getValue());
             if (actions == null || actions.isEmpty()) {
                 LOG.error("Unable to send solicited router advertisement packet out. Since Egress "
@@ -80,7 +84,7 @@ public class Ipv6RouterAdvt {
         return true;
     }
 
-    private void updateRAResponse(Ipv6RtrAdvertType raType, RouterSolicitationPacket pdu,
+    private void updateRAResponse(Ipv6RouterAdvertisementType raType, RouterSolicitationPacket pdu,
                                   RouterAdvertisementPacketBuilder raPacket,
                                   VirtualPort routerPort) {
         short icmpv6RaFlags = 0;
@@ -97,18 +101,18 @@ public class Ipv6RouterAdvt {
             }
 
             if (!subnet.getIpv6RAMode().isEmpty()) {
-                if (Ipv6Constants.IPV6_AUTO_ADDRESS_SUBNETS.contains(subnet.getIpv6RAMode())) {
+                if (Ipv6ServiceConstants.IPV6_AUTO_ADDRESS_SUBNETS.contains(subnet.getIpv6RAMode())) {
                     autoConfigPrefixList.add(String.valueOf(subnet.getSubnetCidr().getValue()));
                 }
 
-                if (subnet.getIpv6RAMode().equalsIgnoreCase(Ipv6Constants.IPV6_DHCPV6_STATEFUL)) {
+                if (subnet.getIpv6RAMode().equalsIgnoreCase(Ipv6ServiceConstants.IPV6_DHCPV6_STATEFUL)) {
                     statefulConfigPrefixList.add(String.valueOf(subnet.getSubnetCidr().getValue()));
                 }
             }
 
-            if (subnet.getIpv6RAMode().equalsIgnoreCase(Ipv6Constants.IPV6_DHCPV6_STATELESS)) {
+            if (subnet.getIpv6RAMode().equalsIgnoreCase(Ipv6ServiceConstants.IPV6_DHCPV6_STATELESS)) {
                 icmpv6RaFlags = (short) (icmpv6RaFlags | 1 << 6); // Other Configuration.
-            } else if (subnet.getIpv6RAMode().equalsIgnoreCase(Ipv6Constants.IPV6_DHCPV6_STATEFUL)) {
+            } else if (subnet.getIpv6RAMode().equalsIgnoreCase(Ipv6ServiceConstants.IPV6_DHCPV6_STATEFUL)) {
                 icmpv6RaFlags = (short) (icmpv6RaFlags | 1 << 7); // Managed Address Conf.
             }
         }
@@ -117,35 +121,35 @@ public class Ipv6RouterAdvt {
 
         MacAddress sourceMac = MacAddress.getDefaultInstance(gatewayMac);
         raPacket.setSourceMac(sourceMac);
-        if (raType == Ipv6RtrAdvertType.SOLICITED_ADVERTISEMENT) {
+        if (raType == Ipv6RouterAdvertisementType.SOLICITED_ADVERTISEMENT) {
             raPacket.setDestinationMac(pdu.getSourceMac());
             raPacket.setDestinationIpv6(pdu.getSourceIpv6());
             raPacket.setFlowLabel(pdu.getFlowLabel());
         } else {
-            raPacket.setDestinationMac(new MacAddress(Ipv6Constants.DEF_MCAST_MAC));
+            raPacket.setDestinationMac(new MacAddress(Ipv6Constants.ALL_NODES_MCAST_MAC));
             raPacket.setDestinationIpv6(Ipv6ServiceUtils.ALL_NODES_MCAST_ADDR);
-            raPacket.setFlowLabel(Ipv6Constants.DEF_FLOWLABEL);
+            raPacket.setFlowLabel(Ipv6ServiceConstants.DEF_FLOWLABEL);
         }
 
-        raPacket.setEthertype(Ipv6Constants.IP_V6_ETHTYPE);
+        raPacket.setEthertype(NwConstants.ETHTYPE_IPV6);
 
         raPacket.setVersion(Ipv6Constants.IPV6_VERSION);
         int prefixListLength = autoConfigPrefixList.size() + statefulConfigPrefixList.size();
         raPacket.setIpv6Length(Ipv6Constants.ICMPV6_RA_LENGTH_WO_OPTIONS
                 + Ipv6Constants.ICMPV6_OPTION_SOURCE_LLA_LENGTH
                 + prefixListLength * Ipv6Constants.ICMPV6_OPTION_PREFIX_LENGTH);
-        raPacket.setNextHeader(Ipv6Constants.ICMP6_NHEADER);
+        raPacket.setNextHeader(IPProtocols.IPV6ICMP.shortValue());
         raPacket.setHopLimit(Ipv6Constants.ICMP_V6_MAX_HOP_LIMIT);
-        raPacket.setSourceIpv6(Ipv6ServiceUtils.getIpv6LinkLocalAddressFromMac(sourceMac));
+        raPacket.setSourceIpv6(Ipv6Util.getIpv6LinkLocalAddressFromMac(sourceMac));
 
-        raPacket.setIcmp6Type(Ipv6Constants.ICMP_V6_RA_CODE);
+        raPacket.setIcmp6Type(Icmpv6Type.ROUTER_ADVETISEMENT.getValue());
         raPacket.setIcmp6Code((short)0);
         raPacket.setIcmp6Chksum(0);
 
         raPacket.setCurHopLimit((short) Ipv6Constants.IPV6_DEFAULT_HOP_LIMIT);
         raPacket.setFlags(icmpv6RaFlags);
 
-        if (raType == Ipv6RtrAdvertType.CEASE_ADVERTISEMENT) {
+        if (raType == Ipv6RouterAdvertisementType.CEASE_ADVERTISEMENT) {
             raPacket.setRouterLifetime(0);
         } else {
             raPacket.setRouterLifetime(Ipv6Constants.IPV6_ROUTER_LIFETIME);
@@ -192,10 +196,10 @@ public class Ipv6RouterAdvt {
     private byte[] fillRouterAdvertisementPacket(RouterAdvertisementPacket pdu) {
         ByteBuffer buf = ByteBuffer.allocate(Ipv6Constants.ICMPV6_OFFSET + pdu.getIpv6Length());
 
-        buf.put(Ipv6ServiceUtils.convertEthernetHeaderToByte(pdu), 0, 14);
-        buf.put(Ipv6ServiceUtils.convertIpv6HeaderToByte(pdu), 0, 40);
+        buf.put(Ipv6Util.convertEthernetHeaderToByte(pdu), 0, 14);
+        buf.put(Ipv6Util.convertIpv6HeaderToByte(pdu), 0, 40);
         buf.put(icmp6RAPayloadtoByte(pdu), 0, pdu.getIpv6Length());
-        int checksum = Ipv6ServiceUtils.calcIcmpv6Checksum(buf.array(), pdu);
+        int checksum = Ipv6Util.calculateIcmpv6Checksum(buf.array(), pdu);
         buf.putShort(Ipv6Constants.ICMPV6_OFFSET + 2, (short)checksum);
         return buf.array();
     }
@@ -215,7 +219,7 @@ public class Ipv6RouterAdvt {
         buf.putInt((int)pdu.getRetransTime().longValue());
         buf.put((byte)pdu.getOptionSourceAddr().shortValue());
         buf.put((byte)pdu.getSourceAddrLength().shortValue());
-        buf.put(Ipv6ServiceUtils.bytesFromHexString(pdu.getSourceLlAddress().getValue()));
+        buf.put(Ipv6Util.bytesFromHexString(pdu.getSourceLlAddress().getValue()));
 
         for (PrefixList prefix : pdu.getPrefixList()) {
             buf.put((byte)prefix.getOptionType().shortValue());
index 81b22cea9292096721275526b448e239bf962aff..dd07152df552a46a33de9ba148fcc72cf6e6d19b 100644 (file)
@@ -20,7 +20,7 @@ import org.opendaylight.genius.mdsalutil.MDSALUtil;
 import org.opendaylight.genius.mdsalutil.NwConstants;
 import org.opendaylight.genius.utils.SystemPropertyReader;
 import org.opendaylight.infrautils.jobcoordinator.JobCoordinator;
-import org.opendaylight.netvirt.ipv6service.utils.Ipv6Constants;
+import org.opendaylight.netvirt.ipv6service.utils.Ipv6ServiceConstants;
 import org.opendaylight.netvirt.ipv6service.utils.Ipv6ServiceUtils;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.iana._if.type.rev140508.L2vlan;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.InterfacesState;
@@ -102,7 +102,7 @@ public class Ipv6ServiceInterfaceEventListener
 
         VirtualPort routerPort = ifMgr.getRouterV6InterfaceForNetwork(port.getNetworkID());
         ifMgr.handleInterfaceStateEvent(port, ipv6ServiceUtils.getDpIdFromInterfaceState(del), routerPort,
-                Ipv6Constants.DEL_FLOW);
+                Ipv6ServiceConstants.DEL_FLOW);
     }
 
     @Override
@@ -143,7 +143,7 @@ public class Ipv6ServiceInterfaceEventListener
             NodeConnectorId nodeConnectorId = new NodeConnectorId(ofportIds.get(0));
             BigInteger dpId = BigInteger.valueOf(MDSALUtil.getDpnIdFromPortName(nodeConnectorId));
 
-            if (!dpId.equals(Ipv6Constants.INVALID_DPID)) {
+            if (!dpId.equals(Ipv6ServiceConstants.INVALID_DPID)) {
                 Uuid portId = new Uuid(iface.getName());
                 VirtualPort port = ifMgr.obtainV6Interface(portId);
                 if (port == null) {
@@ -164,7 +164,7 @@ public class Ipv6ServiceInterfaceEventListener
                     LOG.info("Port {} is not associated to a Router, skipping.", portId);
                     return;
                 }
-                ifMgr.handleInterfaceStateEvent(port, dpId, routerPort, Ipv6Constants.ADD_FLOW);
+                ifMgr.handleInterfaceStateEvent(port, dpId, routerPort, Ipv6ServiceConstants.ADD_FLOW);
 
                 if (!port.getServiceBindingStatus()) {
                     jobCoordinator.enqueueJob("IPv6-" + String.valueOf(portId), () -> {
index 7c5b2df90d27dc5cc0b6351fb7adceb5735793b4..ea2786164cfae2ed659d120369e1b01119a96a28 100644 (file)
@@ -17,7 +17,7 @@ import javax.inject.Singleton;
 import org.opendaylight.controller.md.sal.binding.api.DataBroker;
 import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
 import org.opendaylight.genius.datastoreutils.AsyncClusteredDataTreeChangeListenerBase;
-import org.opendaylight.netvirt.ipv6service.utils.Ipv6Constants;
+import org.opendaylight.netvirt.ipv6service.utils.Ipv6ServiceConstants;
 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.neutron.ports.rev150712.port.attributes.FixedIps;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.ports.rev150712.ports.attributes.Ports;
@@ -53,12 +53,12 @@ public class NeutronPortChangeListener extends AsyncClusteredDataTreeChangeListe
 
     @Override
     protected void add(InstanceIdentifier<Port> identifier, Port port) {
-        if (port.getDeviceOwner().equalsIgnoreCase(Ipv6Constants.NETWORK_ROUTER_GATEWAY)) {
+        if (port.getDeviceOwner().equalsIgnoreCase(Ipv6ServiceConstants.NETWORK_ROUTER_GATEWAY)) {
             // Todo: revisit when IPv6 north-south support is implemented.
             LOG.info("IPv6Service (TODO): Skipping router_gateway port {} for add event", port);
             return;
         }
-        if (port.getDeviceOwner().equalsIgnoreCase(Ipv6Constants.DEVICE_OWNER_DHCP)) {
+        if (port.getDeviceOwner().equalsIgnoreCase(Ipv6ServiceConstants.DEVICE_OWNER_DHCP)) {
             LOG.info("IPv6Service: Skipping network_dhcp port {} for add event", port);
             return;
         }
@@ -75,12 +75,12 @@ public class NeutronPortChangeListener extends AsyncClusteredDataTreeChangeListe
 
     @Override
     protected void remove(InstanceIdentifier<Port> identifier, Port port) {
-        if (port.getDeviceOwner().equalsIgnoreCase(Ipv6Constants.NETWORK_ROUTER_GATEWAY)) {
+        if (port.getDeviceOwner().equalsIgnoreCase(Ipv6ServiceConstants.NETWORK_ROUTER_GATEWAY)) {
             // Todo: revisit when IPv6 north-south support is implemented.
             LOG.info("IPv6Service (TODO): Skipping router_gateway port {} for remove event", port);
             return;
         }
-        if (port.getDeviceOwner().equalsIgnoreCase(Ipv6Constants.DEVICE_OWNER_DHCP)) {
+        if (port.getDeviceOwner().equalsIgnoreCase(Ipv6ServiceConstants.DEVICE_OWNER_DHCP)) {
             LOG.info("IPv6Service: Skipping network_dhcp port {} for remove event", port);
             return;
         }
@@ -91,12 +91,12 @@ public class NeutronPortChangeListener extends AsyncClusteredDataTreeChangeListe
 
     @Override
     protected void update(InstanceIdentifier<Port> identifier, Port original, Port update) {
-        if (update.getDeviceOwner().equalsIgnoreCase(Ipv6Constants.NETWORK_ROUTER_GATEWAY)) {
+        if (update.getDeviceOwner().equalsIgnoreCase(Ipv6ServiceConstants.NETWORK_ROUTER_GATEWAY)) {
             // Todo: revisit when IPv6 north-south support is implemented.
             LOG.info("IPv6Service (TODO): Skipping router_gateway port {} for update event", update);
             return;
         }
-        if (update.getDeviceOwner().equalsIgnoreCase(Ipv6Constants.DEVICE_OWNER_DHCP)) {
+        if (update.getDeviceOwner().equalsIgnoreCase(Ipv6ServiceConstants.DEVICE_OWNER_DHCP)) {
             LOG.info("IPv6Service: Skipping network_dhcp port {} for update event", update);
             return;
         }
@@ -123,7 +123,7 @@ public class NeutronPortChangeListener extends AsyncClusteredDataTreeChangeListe
                 addInterfaceInfo(update, fixedip);
             }
 
-            if (update.getDeviceOwner().equalsIgnoreCase(Ipv6Constants.NETWORK_ROUTER_INTERFACE)) {
+            if (update.getDeviceOwner().equalsIgnoreCase(Ipv6ServiceConstants.NETWORK_ROUTER_INTERFACE)) {
                 ifMgr.updateRouterIntf(update.getUuid(), new Uuid(update.getDeviceId()), update.getFixedIps(),
                         deletedIps);
             } else {
@@ -133,7 +133,7 @@ public class NeutronPortChangeListener extends AsyncClusteredDataTreeChangeListe
     }
 
     protected void addInterfaceInfo(Port port, FixedIps fixedip) {
-        if (port.getDeviceOwner().equalsIgnoreCase(Ipv6Constants.NETWORK_ROUTER_INTERFACE)) {
+        if (port.getDeviceOwner().equalsIgnoreCase(Ipv6ServiceConstants.NETWORK_ROUTER_INTERFACE)) {
             LOG.info("IPv6: addInterfaceInfo is invoked for a router interface {}, fixedIp: {}", port, fixedip);
             // Add router interface
             ifMgr.addRouterIntf(port.getUuid(),
index d88e697621b743887074f36d64e623e71acc47f8..d1620cd93cb70a73a9fa33107a7ea23edb8fdad3 100644 (file)
@@ -14,7 +14,7 @@ import javax.inject.Singleton;
 import org.opendaylight.controller.md.sal.binding.api.DataBroker;
 import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
 import org.opendaylight.genius.datastoreutils.AsyncClusteredDataTreeChangeListenerBase;
-import org.opendaylight.netvirt.ipv6service.utils.Ipv6Constants;
+import org.opendaylight.netvirt.ipv6service.utils.Ipv6ServiceConstants;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.constants.rev150712.Dhcpv6Base;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.constants.rev150712.Dhcpv6Off;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.constants.rev150712.Dhcpv6Slaac;
@@ -39,16 +39,16 @@ public class NeutronSubnetChangeListener extends AsyncClusteredDataTreeChangeLis
 
     private static final ImmutableBiMap<Class<? extends IpVersionBase>,String> IPV_MAP
             = new ImmutableBiMap.Builder<Class<? extends IpVersionBase>,String>()
-            .put(IpVersionV4.class, Ipv6Constants.IP_VERSION_V4)
-            .put(IpVersionV6.class, Ipv6Constants.IP_VERSION_V6)
+            .put(IpVersionV4.class, Ipv6ServiceConstants.IP_VERSION_V4)
+            .put(IpVersionV6.class, Ipv6ServiceConstants.IP_VERSION_V6)
             .build();
 
     private static final ImmutableBiMap<Class<? extends Dhcpv6Base>,String> DHCPV6_MAP
             = new ImmutableBiMap.Builder<Class<? extends Dhcpv6Base>,String>()
-            .put(Dhcpv6Off.class,Ipv6Constants.DHCPV6_OFF)
-            .put(Dhcpv6Stateful.class,Ipv6Constants.IPV6_DHCPV6_STATEFUL)
-            .put(Dhcpv6Slaac.class,Ipv6Constants.IPV6_SLAAC)
-            .put(Dhcpv6Stateless.class,Ipv6Constants.IPV6_DHCPV6_STATELESS)
+            .put(Dhcpv6Off.class,Ipv6ServiceConstants.DHCPV6_OFF)
+            .put(Dhcpv6Stateful.class,Ipv6ServiceConstants.IPV6_DHCPV6_STATEFUL)
+            .put(Dhcpv6Slaac.class,Ipv6ServiceConstants.IPV6_SLAAC)
+            .put(Dhcpv6Stateless.class,Ipv6ServiceConstants.IPV6_DHCPV6_STATELESS)
             .build();
 
     @Inject
@@ -70,7 +70,7 @@ public class NeutronSubnetChangeListener extends AsyncClusteredDataTreeChangeLis
 
     @Override
     protected void add(InstanceIdentifier<Subnet> identifier, Subnet input) {
-        if (IPV_MAP.get(input.getIpVersion()).equals(Ipv6Constants.IP_VERSION_V6)) {
+        if (IPV_MAP.get(input.getIpVersion()).equals(Ipv6ServiceConstants.IP_VERSION_V6)) {
             LOG.info("Add Subnet notification handler is invoked {} ", input);
             String ipv6AddrMode = "";
             if (input.getIpv6AddressMode() != null) {
index 670239f8cd470323bd392c187a8a7a6d3a782fcb..6a2c11ccd952c1fcf43b14067a027f580c048cc6 100644 (file)
@@ -16,7 +16,7 @@ import java.util.concurrent.ConcurrentMap;
 import java.util.stream.Collectors;
 import java.util.stream.Stream;
 import org.opendaylight.netvirt.ipv6service.api.IVirtualNetwork;
-import org.opendaylight.netvirt.ipv6service.utils.Ipv6Constants;
+import org.opendaylight.netvirt.ipv6service.utils.Ipv6ServiceConstants;
 import org.opendaylight.netvirt.ipv6service.utils.Ipv6ServiceUtils;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6Address;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Uuid;
@@ -41,7 +41,7 @@ public class VirtualNetwork implements IVirtualNetwork {
         }
         synchronized (networkUUID.getValue()) {
             DpnInterfaceInfo dpnInterface = dpnIfaceList.computeIfAbsent(dpnId, key -> new DpnInterfaceInfo(dpnId));
-            if (addOrRemove == Ipv6Constants.ADD_ENTRY) {
+            if (addOrRemove == Ipv6ServiceConstants.ADD_ENTRY) {
                 dpnInterface.updateofPortList(ofPort);
             } else {
                 dpnInterface.removeOfPortFromList(ofPort);
@@ -84,7 +84,7 @@ public class VirtualNetwork implements IVirtualNetwork {
         if (null != dpnInterface) {
             return dpnInterface.getRsFlowConfiguredStatus();
         }
-        return Ipv6Constants.FLOWS_NOT_CONFIGURED;
+        return Ipv6ServiceConstants.FLOWS_NOT_CONFIGURED;
     }
 
     public void clearDpnInterfaceList() {
@@ -117,7 +117,7 @@ public class VirtualNetwork implements IVirtualNetwork {
 
         DpnInterfaceInfo(BigInteger dpnId) {
             dpId = dpnId;
-            rsPuntFlowConfigured = Ipv6Constants.FLOWS_NOT_CONFIGURED;
+            rsPuntFlowConfigured = Ipv6ServiceConstants.FLOWS_NOT_CONFIGURED;
         }
 
         public void setDpId(BigInteger dpId) {
@@ -137,7 +137,7 @@ public class VirtualNetwork implements IVirtualNetwork {
         }
 
         public void updateSubnetCidrFlowStatus(Uuid subnetUUID, int addOrRemove) {
-            if (addOrRemove == Ipv6Constants.ADD_FLOW) {
+            if (addOrRemove == Ipv6ServiceConstants.ADD_FLOW) {
                 this.subnetCidrPuntFlowList.add(subnetUUID);
             } else {
                 this.subnetCidrPuntFlowList.remove(subnetUUID);
@@ -155,7 +155,7 @@ public class VirtualNetwork implements IVirtualNetwork {
         public void updateNDTargetAddress(Ipv6Address ipv6Address, int addOrRemove) {
             Ipv6Address ipv6 =
                     Ipv6Address.getDefaultInstance(Ipv6ServiceUtils.getFormattedIpv6Address(ipv6Address.getValue()));
-            if (addOrRemove == Ipv6Constants.ADD_ENTRY) {
+            if (addOrRemove == Ipv6ServiceConstants.ADD_ENTRY) {
                 this.ndTargetFlowsPunted.add(ipv6);
             } else {
                 this.ndTargetFlowsPunted.remove(ipv6);
index f7ce4712a87b234f34e83c6c993f1536c07753d2..38c1f709bc4f65a22ec42e534891dac94d33a5e7 100644 (file)
@@ -16,11 +16,11 @@ import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.ConcurrentMap;
 import java.util.stream.Collectors;
 import java.util.stream.Stream;
+import org.opendaylight.genius.ipv6util.api.Ipv6Util;
 import org.opendaylight.netvirt.ipv6service.api.IVirtualPort;
-import org.opendaylight.netvirt.ipv6service.utils.Ipv6Constants;
 import org.opendaylight.netvirt.ipv6service.utils.Ipv6PeriodicTimer;
 import org.opendaylight.netvirt.ipv6service.utils.Ipv6PeriodicTrQueue;
-import org.opendaylight.netvirt.ipv6service.utils.Ipv6ServiceUtils;
+import org.opendaylight.netvirt.ipv6service.utils.Ipv6ServiceConstants;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6Address;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress;
@@ -117,8 +117,8 @@ public class VirtualPort implements IVirtualPort  {
         List<Ipv6Address> ipv6AddrList = snetInfo.values().stream().flatMap(
             subnetInfo -> Stream.of(subnetInfo.getIpAddr().getIpv6Address())).collect(Collectors.toList());
 
-        if (deviceOwner.equalsIgnoreCase(Ipv6Constants.NETWORK_ROUTER_INTERFACE)) {
-            Ipv6Address llAddr = Ipv6ServiceUtils.getIpv6LinkLocalAddressFromMac(new MacAddress(macAddress));
+        if (deviceOwner.equalsIgnoreCase(Ipv6ServiceConstants.NETWORK_ROUTER_INTERFACE)) {
+            Ipv6Address llAddr = Ipv6Util.getIpv6LinkLocalAddressFromMac(new MacAddress(macAddress));
             ipv6AddrList.add(llAddr);
         }
         return ipv6AddrList;
similarity index 55%
rename from ipv6service/impl/src/main/java/org/opendaylight/netvirt/ipv6service/utils/Ipv6Constants.java
rename to ipv6service/impl/src/main/java/org/opendaylight/netvirt/ipv6service/utils/Ipv6ServiceConstants.java
index 6569fdc830051a7636906c336bd6a5338a552cba..43607b5c1a39308c35f05f5406e3b481643b3d69 100644 (file)
@@ -10,41 +10,7 @@ package org.opendaylight.netvirt.ipv6service.utils;
 
 import java.math.BigInteger;
 
-public interface Ipv6Constants {
-
-    short IP_VERSION_6 = 6;
-    int IP_V6_ETHTYPE = 0x86DD;
-    int ICMP_V6 = 1;
-
-    int ETHTYPE_START = 96;
-    int ONE_BYTE  = 8;
-    int TWO_BYTES = 16;
-    int IP_V6_HDR_START = 112;
-    int IP_V6_NEXT_HDR = 48;
-    int ICMPV6_HDR_START = 432;
-
-    int ICMPV6_RA_LENGTH_WO_OPTIONS = 16;
-    int ICMPV6_OPTION_SOURCE_LLA_LENGTH = 8;
-    int ICMPV6_OPTION_PREFIX_LENGTH = 32;
-
-    int ICMPV6_NA_LENGTH_WO_OPTIONS = 24;
-
-    int IPV6_DEFAULT_HOP_LIMIT = 64;
-    int IPV6_ROUTER_LIFETIME = 4500;
-    int IPV6_RA_VALID_LIFETIME = 2592000;
-    int IPV6_RA_PREFERRED_LIFETIME = 604800;
-    int IPV6_RA_REACHABLE_TIME = 120000;
-
-    short ICMP_V6_TYPE = 58;
-    short ICMP_V6_RS_CODE = 133;
-    short ICMP_V6_RA_CODE = 134;
-    short ICMP_V6_NS_CODE = 135;
-    short ICMP_V6_NA_CODE = 136;
-    short ICMP_V6_MAX_HOP_LIMIT = 255;
-    int ICMPV6_OFFSET = 54;
-
-    short ICMP_V6_OPTION_SOURCE_LLA = 1;
-    short ICMP_V6_OPTION_TARGET_LLA = 2;
+public interface Ipv6ServiceConstants {
 
     String DHCPV6_OFF = "DHCPV6_OFF";
     String IPV6_SLAAC = "IPV6_SLAAC";
@@ -72,17 +38,8 @@ public interface Ipv6Constants {
     int FLOWS_CONFIGURED = 1;
     int FLOWS_NOT_CONFIGURED = 0;
     String OPENFLOW_NODE_PREFIX = "openflow:";
-    short IPV6_VERSION = 6;
-    short ICMP6_NHEADER = 58;
     long DEF_FLOWLABEL = 0;
-    String DEF_MCAST_MAC = "33:33:00:00:00:01";
     //default periodic RA transmission interval. timeunit in sec
     long PERIODIC_RA_INTERVAL = 60;
     int ELAN_GID_MIN = 200000;
-
-    enum Ipv6RtrAdvertType {
-        UNSOLICITED_ADVERTISEMENT,
-        SOLICITED_ADVERTISEMENT,
-        CEASE_ADVERTISEMENT
-    }
 }
index 370400440d2b3af3f98cf264e53c1759ff0f13a0..5bbb0933c82e3b0a02834eb8085bef6f03b92060 100644 (file)
@@ -9,13 +9,10 @@
 package org.opendaylight.netvirt.ipv6service.utils;
 
 import com.google.common.base.Optional;
-import com.google.common.net.InetAddresses;
 import java.math.BigInteger;
 import java.net.InetAddress;
 import java.net.UnknownHostException;
-import java.nio.ByteBuffer;
 import java.util.ArrayList;
-import java.util.Arrays;
 import java.util.List;
 import java.util.concurrent.ExecutionException;
 import javax.inject.Inject;
@@ -24,6 +21,8 @@ import org.apache.commons.lang3.StringUtils;
 import org.opendaylight.controller.md.sal.binding.api.DataBroker;
 import org.opendaylight.controller.md.sal.binding.api.ReadOnlyTransaction;
 import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
+import org.opendaylight.genius.ipv6util.api.Icmpv6Type;
+import org.opendaylight.genius.ipv6util.api.Ipv6Constants;
 import org.opendaylight.genius.mdsalutil.ActionInfo;
 import org.opendaylight.genius.mdsalutil.FlowEntity;
 import org.opendaylight.genius.mdsalutil.InstructionInfo;
@@ -49,7 +48,6 @@ import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.InterfacesState;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.InterfaceKey;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.Interface;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.list.Instruction;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.servicebinding.rev160406.ServiceBindings;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.servicebinding.rev160406.ServiceModeIngress;
@@ -62,8 +60,6 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.ser
 import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.servicebinding.rev160406.service.bindings.services.info.BoundServicesBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.servicebinding.rev160406.service.bindings.services.info.BoundServicesKey;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorId;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.ipv6service.nd.packet.rev160620.EthernetHeader;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.ipv6service.nd.packet.rev160620.Ipv6Header;
 import org.opendaylight.yangtools.yang.binding.DataObject;
 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
 import org.slf4j.Logger;
@@ -72,7 +68,7 @@ import org.slf4j.LoggerFactory;
 @Singleton
 public class Ipv6ServiceUtils {
     private static final Logger LOG = LoggerFactory.getLogger(Ipv6ServiceUtils.class);
-    public static final Ipv6Address ALL_NODES_MCAST_ADDR = newIpv6Address("FF02::1");
+    public static final Ipv6Address ALL_NODES_MCAST_ADDR = newIpv6Address(Ipv6Constants.ALL_NODES_MCAST_ADDRESS);
     public static final Ipv6Address UNSPECIFIED_ADDR = newIpv6Address("0:0:0:0:0:0:0:0");
 
     private static Ipv6Address newIpv6Address(String ip) {
@@ -164,222 +160,11 @@ public class Ipv6ServiceUtils {
         return MDSALUtil.read(LogicalDatastoreType.OPERATIONAL, ifStateId, broker).orNull();
     }
 
-    public static String bytesToHexString(byte[] bytes) {
-        if (bytes == null) {
-            return "null";
-        }
-        StringBuilder buf = new StringBuilder();
-        for (int i = 0; i < bytes.length; i++) {
-            if (i > 0) {
-                buf.append(":");
-            }
-            short u8byte = (short) (bytes[i] & 0xff);
-            String tmp = Integer.toHexString(u8byte);
-            if (tmp.length() == 1) {
-                buf.append("0");
-            }
-            buf.append(tmp);
-        }
-        return buf.toString();
-    }
-
-    public static byte[] bytesFromHexString(String values) {
-        String target = "";
-        if (values != null) {
-            target = values;
-        }
-        String[] octets = target.split(":");
-
-        byte[] ret = new byte[octets.length];
-        for (int i = 0; i < octets.length; i++) {
-            ret[i] = Integer.valueOf(octets[i], 16).byteValue();
-        }
-        return ret;
-    }
-
-    public static int calcIcmpv6Checksum(byte[] packet, Ipv6Header ip6Hdr) {
-        long checksum = getSummation(ip6Hdr.getSourceIpv6());
-        checksum += getSummation(ip6Hdr.getDestinationIpv6());
-        checksum = normalizeChecksum(checksum);
-
-        checksum += ip6Hdr.getIpv6Length();
-        checksum += ip6Hdr.getNextHeader();
-
-        int icmp6Offset = Ipv6Constants.ICMPV6_OFFSET;
-        long value = (packet[icmp6Offset] & 0xff) << 8 | packet[icmp6Offset + 1] & 0xff;
-        checksum += value;
-        checksum = normalizeChecksum(checksum);
-        icmp6Offset += 2;
-
-        //move to icmp6 payload skipping the checksum field
-        icmp6Offset += 2;
-        int length = packet.length - icmp6Offset;
-        while (length > 1) {
-            value = (packet[icmp6Offset] & 0xff) << 8 | packet[icmp6Offset + 1] & 0xff;
-            checksum += value;
-            checksum = normalizeChecksum(checksum);
-            icmp6Offset += 2;
-            length -= 2;
-        }
-
-        if (length > 0) {
-            checksum += packet[icmp6Offset];
-            checksum = normalizeChecksum(checksum);
-        }
-
-        int finalChecksum = (int)(~checksum & 0xffff);
-        return finalChecksum;
-    }
-
-    public static boolean validateChecksum(byte[] packet, Ipv6Header ip6Hdr, int recvChecksum) {
-        return calcIcmpv6Checksum(packet, ip6Hdr) == recvChecksum;
-    }
-
-    private static long getSummation(Ipv6Address addr) {
-        byte[] baddr = null;
-        try {
-            baddr = InetAddress.getByName(addr.getValue()).getAddress();
-        } catch (UnknownHostException e) {
-            LOG.error("getSummation: Failed to deserialize address {}", addr.getValue(), e);
-            return 0;
-        }
-
-        long sum = 0;
-        int len = 0;
-        long value = 0;
-        while (len < baddr.length) {
-            value = (baddr[len] & 0xff) << 8 | baddr[len + 1] & 0xff;
-            sum += value;
-            sum = normalizeChecksum(sum);
-            len += 2;
-        }
-        return sum;
-    }
-
-    private static  long normalizeChecksum(long value) {
-        if ((value & 0xffff0000) != 0) {
-            value = value & 0xffff;
-            value += 1;
-        }
-        return value;
-    }
-
-    public static byte[] convertEthernetHeaderToByte(EthernetHeader ethPdu) {
-        byte[] data = new byte[16];
-        Arrays.fill(data, (byte)0);
-
-        ByteBuffer buf = ByteBuffer.wrap(data);
-        buf.put(bytesFromHexString(ethPdu.getDestinationMac().getValue()));
-        buf.put(bytesFromHexString(ethPdu.getSourceMac().getValue()));
-        buf.putShort((short)ethPdu.getEthertype().intValue());
-        return data;
-    }
-
-    public static byte[] convertIpv6HeaderToByte(Ipv6Header ip6Pdu) {
-        byte[] data = new byte[128];
-        Arrays.fill(data, (byte)0);
-
-        ByteBuffer buf = ByteBuffer.wrap(data);
-        long flowLabel = (long)(ip6Pdu.getVersion() & 0x0f) << 28
-                | ip6Pdu.getFlowLabel() & 0x0fffffff;
-        buf.putInt((int)flowLabel);
-        buf.putShort((short)ip6Pdu.getIpv6Length().intValue());
-        buf.put((byte)ip6Pdu.getNextHeader().shortValue());
-        buf.put((byte)ip6Pdu.getHopLimit().shortValue());
-        try {
-            byte[] baddr = InetAddress.getByName(ip6Pdu.getSourceIpv6().getValue()).getAddress();
-            buf.put(baddr);
-            baddr = InetAddress.getByName(ip6Pdu.getDestinationIpv6().getValue()).getAddress();
-            buf.put(baddr);
-        } catch (UnknownHostException e) {
-            LOG.error("convertIpv6HeaderToByte: Failed to serialize src, dest address", e);
-        }
-        return data;
-    }
-
-    public static Ipv6Address getIpv6LinkLocalAddressFromMac(MacAddress mac) {
-        byte[] octets = bytesFromHexString(mac.getValue());
-
-        /* As per the RFC2373, steps involved to generate a LLA include
-           1. Convert the 48 bit MAC address to 64 bit value by inserting 0xFFFE
-              between OUI and NIC Specific part.
-           2. Invert the Universal/Local flag in the OUI portion of the address.
-           3. Use the prefix "FE80::/10" along with the above 64 bit Interface
-              identifier to generate the IPv6 LLA. */
-
-        StringBuilder interfaceID = new StringBuilder();
-        short u8byte = (short) (octets[0] & 0xff);
-        u8byte ^= 1 << 1;
-        interfaceID.append(Integer.toHexString(0xFF & u8byte));
-        interfaceID.append(StringUtils.leftPad(Integer.toHexString(0xFF & octets[1]), 2, "0"));
-        interfaceID.append(":");
-        interfaceID.append(Integer.toHexString(0xFF & octets[2]));
-        interfaceID.append("ff:fe");
-        interfaceID.append(StringUtils.leftPad(Integer.toHexString(0xFF & octets[3]), 2, "0"));
-        interfaceID.append(":");
-        interfaceID.append(Integer.toHexString(0xFF & octets[4]));
-        interfaceID.append(StringUtils.leftPad(Integer.toHexString(0xFF & octets[5]), 2, "0"));
-
-        // Return the address in its fully expanded format.
-        Ipv6Address ipv6LLA = new Ipv6Address(InetAddresses.forString(
-                "fe80:0:0:0:" + interfaceID.toString()).getHostAddress());
-        return ipv6LLA;
-    }
-
-    public static Ipv6Address getIpv6SolicitedNodeMcastAddress(Ipv6Address ipv6Address) {
-
-        /* According to RFC 4291, a Solicited Node Multicast Address is derived by adding the 24
-           lower order bits with the Solicited Node multicast prefix (i.e., FF02::1:FF00:0/104).
-           Example: For IPv6Address of FE80::2AA:FF:FE28:9C5A, the corresponding solicited node
-           multicast address would be FF02::1:FF28:9C5A
-         */
-
-        byte[] octets;
-        try {
-            octets = InetAddress.getByName(ipv6Address.getValue()).getAddress();
-        } catch (UnknownHostException e) {
-            LOG.error("getIpv6SolicitedNodeMcastAddress: Failed to serialize ipv6Address ", e);
-            return null;
-        }
-
-        // Return the address in its fully expanded format.
-        Ipv6Address solictedV6Address = new Ipv6Address(InetAddresses.forString("ff02::1:ff"
-                 + StringUtils.leftPad(Integer.toHexString(0xFF & octets[13]), 2, "0") + ":"
-                 + StringUtils.leftPad(Integer.toHexString(0xFF & octets[14]), 2, "0")
-                 + StringUtils.leftPad(Integer.toHexString(0xFF & octets[15]), 2, "0")).getHostAddress());
-
-        return solictedV6Address;
-    }
-
-    public static MacAddress getIpv6MulticastMacAddress(Ipv6Address ipv6Address) {
-
-        /* According to RFC 2464, a Multicast MAC address is derived by concatenating 32 lower
-           order bits of IPv6 Multicast Address with the multicast prefix (i.e., 33:33).
-           Example: For Multicast IPv6Address of FF02::1:FF28:9C5A, the corresponding L2 multicast
-           address would be 33:33:28:9C:5A
-         */
-        byte[] octets;
-        try {
-            octets = InetAddress.getByName(ipv6Address.getValue()).getAddress();
-        } catch (UnknownHostException e) {
-            LOG.error("getIpv6MulticastMacAddress: Failed to serialize ipv6Address ", e);
-            return null;
-        }
-
-        String macAddress = "33:33:"
-                + StringUtils.leftPad(Integer.toHexString(0xFF & octets[12]), 2, "0") + ":"
-                + StringUtils.leftPad(Integer.toHexString(0xFF & octets[13]), 2, "0") + ":"
-                + StringUtils.leftPad(Integer.toHexString(0xFF & octets[14]), 2, "0") + ":"
-                + StringUtils.leftPad(Integer.toHexString(0xFF & octets[15]), 2, "0");
-
-        return new MacAddress(macAddress);
-    }
-
     private static List<MatchInfo> getIcmpv6RSMatch(Long elanTag) {
         List<MatchInfo> matches = new ArrayList<>();
         matches.add(MatchEthernetType.IPV6);
         matches.add(MatchIpProtocol.ICMPV6);
-        matches.add(new MatchIcmpv6(Ipv6Constants.ICMP_V6_RS_CODE, (short) 0));
+        matches.add(new MatchIcmpv6(Icmpv6Type.ROUTER_SOLICITATION.getValue(), (short) 0));
         matches.add(new MatchMetadata(MetaDataUtil.getElanTagMetadata(elanTag), MetaDataUtil.METADATA_MASK_SERVICE));
         return matches;
     }
@@ -388,7 +173,7 @@ public class Ipv6ServiceUtils {
         List<MatchInfo> matches = new ArrayList<>();
         matches.add(MatchEthernetType.IPV6);
         matches.add(MatchIpProtocol.ICMPV6);
-        matches.add(new MatchIcmpv6(Ipv6Constants.ICMP_V6_NS_CODE, (short) 0));
+        matches.add(new MatchIcmpv6(Icmpv6Type.NEIGHBOR_SOLICITATION.getValue(), (short) 0));
         matches.add(new MatchIpv6NdTarget(new Ipv6Address(ndTarget)));
         matches.add(new MatchMetadata(MetaDataUtil.getElanTagMetadata(elanTag), MetaDataUtil.METADATA_MASK_SERVICE));
         return matches;
@@ -398,15 +183,15 @@ public class Ipv6ServiceUtils {
         List<MatchInfo> matches = new ArrayList<>();
         matches.add(MatchEthernetType.IPV6);
         matches.add(MatchIpProtocol.ICMPV6);
-        matches.add(new MatchIcmpv6(Ipv6Constants.ICMP_V6_NA_CODE, (short) 0));
+        matches.add(new MatchIcmpv6(Icmpv6Type.NEIGHBOR_ADVERTISEMENT.getValue(), (short) 0));
         matches.add(new MatchMetadata(MetaDataUtil.getElanTagMetadata(elanTag), MetaDataUtil.METADATA_MASK_SERVICE));
         return matches;
     }
 
     private static String getIPv6FlowRef(BigInteger dpId, Long elanTag, String flowType) {
-        return new StringBuffer().append(Ipv6Constants.FLOWID_PREFIX)
-                .append(dpId).append(Ipv6Constants.FLOWID_SEPARATOR)
-                .append(elanTag).append(Ipv6Constants.FLOWID_SEPARATOR)
+        return new StringBuffer().append(Ipv6ServiceConstants.FLOWID_PREFIX)
+                .append(dpId).append(Ipv6ServiceConstants.FLOWID_SEPARATOR)
+                .append(elanTag).append(Ipv6ServiceConstants.FLOWID_SEPARATOR)
                 .append(flowType).toString();
     }
 
@@ -438,10 +223,10 @@ public class Ipv6ServiceUtils {
         instructions.add(new InstructionApplyActions(actionsInfos));
 
         String formattedIp = getFormattedIpv6Address(ipv6Address);
-        FlowEntity rsFlowEntity = MDSALUtil.buildFlowEntity(dpId, tableId,
-                getIPv6FlowRef(dpId, elanTag, formattedIp),Ipv6Constants.DEFAULT_FLOW_PRIORITY, "IPv6NS",
-                0, 0, NwConstants.COOKIE_IPV6_TABLE, neighborSolicitationMatch, instructions);
-        if (addOrRemove == Ipv6Constants.DEL_FLOW) {
+        FlowEntity rsFlowEntity = MDSALUtil.buildFlowEntity(dpId, tableId, getIPv6FlowRef(dpId, elanTag, formattedIp),
+                Ipv6ServiceConstants.DEFAULT_FLOW_PRIORITY, "IPv6NS", 0, 0, NwConstants.COOKIE_IPV6_TABLE,
+                neighborSolicitationMatch, instructions);
+        if (addOrRemove == Ipv6ServiceConstants.DEL_FLOW) {
             LOG.trace("Removing IPv6 Neighbor Solicitation Flow DpId {}, elanTag {}", dpId, elanTag);
             mdsalUtil.removeFlow(rsFlowEntity);
         } else {
@@ -451,7 +236,7 @@ public class Ipv6ServiceUtils {
     }
 
     public void installIcmpv6RsPuntFlow(short tableId, BigInteger dpId, Long elanTag, int addOrRemove) {
-        if (dpId == null || dpId.equals(Ipv6Constants.INVALID_DPID)) {
+        if (dpId == null || dpId.equals(Ipv6ServiceConstants.INVALID_DPID)) {
             return;
         }
         List<MatchInfo> routerSolicitationMatch = getIcmpv6RSMatch(elanTag);
@@ -461,9 +246,9 @@ public class Ipv6ServiceUtils {
         actionsInfos.add(new ActionPuntToController());
         instructions.add(new InstructionApplyActions(actionsInfos));
         FlowEntity rsFlowEntity = MDSALUtil.buildFlowEntity(dpId, tableId,
-                getIPv6FlowRef(dpId, elanTag, "IPv6RS"),Ipv6Constants.DEFAULT_FLOW_PRIORITY, "IPv6RS", 0, 0,
+                getIPv6FlowRef(dpId, elanTag, "IPv6RS"),Ipv6ServiceConstants.DEFAULT_FLOW_PRIORITY, "IPv6RS", 0, 0,
                 NwConstants.COOKIE_IPV6_TABLE, routerSolicitationMatch, instructions);
-        if (addOrRemove == Ipv6Constants.DEL_FLOW) {
+        if (addOrRemove == Ipv6ServiceConstants.DEL_FLOW) {
             LOG.trace("Removing IPv6 Router Solicitation Flow DpId {}, elanTag {}", dpId, elanTag);
             mdsalUtil.removeFlow(rsFlowEntity);
         } else {
@@ -483,11 +268,11 @@ public class Ipv6ServiceUtils {
         for (Ipv6Address ipv6Address : vmPort.getIpv6Addresses()) {
             matches.add(new MatchIpv6Source(ipv6Address.getValue() + NwConstants.IPV6PREFIX));
             String flowId = getIPv6FlowRef(dpId, elanTag,
-                    vmPort.getIntfUUID().getValue() + Ipv6Constants.FLOWID_SEPARATOR + ipv6Address.getValue());
+                    vmPort.getIntfUUID().getValue() + Ipv6ServiceConstants.FLOWID_SEPARATOR + ipv6Address.getValue());
             FlowEntity rsFlowEntity =
-                    MDSALUtil.buildFlowEntity(dpId, tableId, flowId, Ipv6Constants.DEFAULT_FLOW_PRIORITY, "IPv6NA", 0,
-                            0, NwConstants.COOKIE_IPV6_TABLE, matches, instructions);
-            if (addOrRemove == Ipv6Constants.DEL_FLOW) {
+                    MDSALUtil.buildFlowEntity(dpId, tableId, flowId, Ipv6ServiceConstants.DEFAULT_FLOW_PRIORITY,
+                            "IPv6NA", 0, 0, NwConstants.COOKIE_IPV6_TABLE, matches, instructions);
+            if (addOrRemove == Ipv6ServiceConstants.DEL_FLOW) {
                 LOG.trace("Removing IPv6 Neighbor Advertisement Flow DpId {}, elanTag {}, ipv6Address {}", dpId,
                         elanTag, ipv6Address.getValue());
                 mdsalUtil.removeFlow(rsFlowEntity);
@@ -512,9 +297,9 @@ public class Ipv6ServiceUtils {
 
         String flowId = getIPv6FlowRef(dpId, elanTag, "IPv6NA." + ipv6Prefix.getValue());
         FlowEntity rsFlowEntity = MDSALUtil.buildFlowEntity(dpId, tableId,
-                flowId, Ipv6Constants.PUNT_NA_FLOW_PRIORITY,
+                flowId, Ipv6ServiceConstants.PUNT_NA_FLOW_PRIORITY,
                 "IPv6NA", 0, 0, NwConstants.COOKIE_IPV6_TABLE, naMatch, instructions);
-        if (addOrRemove == Ipv6Constants.DEL_FLOW) {
+        if (addOrRemove == Ipv6ServiceConstants.DEL_FLOW) {
             LOG.trace("Removing IPv6 Neighbor Advertisement Flow DpId {}, elanTag {}", dpId, elanTag);
             mdsalUtil.removeFlow(rsFlowEntity);
         } else {
@@ -550,7 +335,7 @@ public class Ipv6ServiceUtils {
         BoundServices
                 serviceInfo =
                 getBoundServices(String.format("%s.%s", "ipv6", interfaceName),
-                        serviceIndex, Ipv6Constants.DEFAULT_FLOW_PRIORITY,
+                        serviceIndex, Ipv6ServiceConstants.DEFAULT_FLOW_PRIORITY,
                         NwConstants.COOKIE_IPV6_TABLE, instructions);
         MDSALUtil.syncWrite(broker, LogicalDatastoreType.CONFIGURATION,
                 buildServiceId(interfaceName, serviceIndex), serviceInfo);
@@ -574,13 +359,13 @@ public class Ipv6ServiceUtils {
     }
 
     public static long getRemoteBCGroup(long elanTag) {
-        return Ipv6Constants.ELAN_GID_MIN + elanTag % Ipv6Constants.ELAN_GID_MIN * 2;
+        return Ipv6ServiceConstants.ELAN_GID_MIN + elanTag % Ipv6ServiceConstants.ELAN_GID_MIN * 2;
     }
 
     public static boolean isVmPort(String deviceOwner) {
         // FIXME: Currently for VM ports, Neutron is sending deviceOwner as empty instead of "compute:nova".
-        // return Ipv6Constants.DEVICE_OWNER_COMPUTE_NOVA.equalsIgnoreCase(deviceOwner);
-        return Ipv6Constants.DEVICE_OWNER_COMPUTE_NOVA.equalsIgnoreCase(deviceOwner)
+        // return Ipv6ServiceConstants.DEVICE_OWNER_COMPUTE_NOVA.equalsIgnoreCase(deviceOwner);
+        return Ipv6ServiceConstants.DEVICE_OWNER_COMPUTE_NOVA.equalsIgnoreCase(deviceOwner)
                 || StringUtils.isEmpty(deviceOwner);
     }
 }
index 13f9fd1e6c4d12b9c72704583aeb8b0183fe35e1..8754ee27481af81ec3d0d805317405eb80fd4636 100644 (file)
@@ -22,8 +22,6 @@
   <odl:rpc-service id="packetProcessingService"
                    interface="org.opendaylight.yang.gen.v1.urn.opendaylight.packet.service.rev130709.PacketProcessingService" />
 
-  <odl:rpc-implementation ref="ipv6NdUtilServiceImpl" />
-
   <odl:notification-listener ref="ipv6PktHandler" />
 
   <service ref="ifMgr" interface="org.opendaylight.netvirt.ipv6service.api.ElementCache" />
diff --git a/ipv6service/impl/src/test/java/org/opendaylight/netvirt/ipv6service/Ipv6NeighborSolicitationTest.java b/ipv6service/impl/src/test/java/org/opendaylight/netvirt/ipv6service/Ipv6NeighborSolicitationTest.java
deleted file mode 100644 (file)
index 895b3e4..0000000
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- * Copyright (c) 2017 Red Hat, Inc. 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.netvirt.ipv6service;
-
-import static org.junit.Assert.assertEquals;
-import static org.mockito.Matchers.any;
-import static org.mockito.Mockito.doReturn;
-import static org.mockito.Mockito.times;
-import static org.mockito.Mockito.verify;
-
-import java.math.BigInteger;
-import org.junit.Before;
-import org.junit.Test;
-import org.mockito.Mockito;
-import org.opendaylight.genius.mdsalutil.MDSALUtil;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6Address;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorRef;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeId;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeRef;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.Nodes;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeKey;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.packet.service.rev130709.PacketProcessingService;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.packet.service.rev130709.TransmitPacketInput;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.packet.service.rev130709.TransmitPacketInputBuilder;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import org.opendaylight.yangtools.yang.common.RpcResultBuilder;
-
-public class Ipv6NeighborSolicitationTest {
-    private Ipv6NeighborSolicitation instance;
-    private PacketProcessingService pktProcessService;
-    private Ipv6TestUtils ipv6TestUtils;
-
-    @Before
-    public void initTest() {
-        pktProcessService = Mockito.mock(PacketProcessingService.class);
-        instance = new Ipv6NeighborSolicitation(pktProcessService);
-        ipv6TestUtils = new Ipv6TestUtils();
-    }
-
-    /**
-     *  Test transmitNeighborSolicitation.
-     */
-    @Test
-    public void testTransmitNeighborSolicitation() {
-        doReturn(RpcResultBuilder.status(true).buildFuture()).when(pktProcessService)
-            .transmitPacket(any(TransmitPacketInput.class));
-
-        BigInteger dpnId = BigInteger.valueOf(1);
-        String macAddr = "08:00:27:FE:8F:95";
-        boolean retValue;
-        Ipv6Address srcIpv6Address = new Ipv6Address("2001:db8::1");
-        Ipv6Address targetIpv6Address = new Ipv6Address("2001:db8::2");
-        InstanceIdentifier<Node> ncId = InstanceIdentifier.builder(Nodes.class)
-                .child(Node.class, new NodeKey(new NodeId("openflow:1"))).build();
-        NodeConnectorRef nodeRef = new NodeConnectorRef(ncId);
-        retValue = instance.transmitNeighborSolicitation(dpnId, nodeRef, new MacAddress(macAddr),
-                srcIpv6Address, targetIpv6Address);
-        assertEquals(true, retValue);
-        verify(pktProcessService, times(1)).transmitPacket(any(TransmitPacketInput.class));
-
-        byte[] expectedPayload = ipv6TestUtils.buildPacket(
-                "33 33 00 00 00 02",                               // Destination MAC
-                "08 00 27 FE 8F 95",                               // Source MAC
-                "86 DD",                                           // Ethertype - IPv6
-                "60 00 00 00",                                     // Version 6, traffic class 0, no flowlabel
-                "00 20",                                           // Payload length
-                "3A",                                              // Next header is ICMPv6
-                "FF",                                              // Hop limit
-                "20 01 0D B8 00 00 00 00 00 00 00 00 00 00 00 01", // Source IP
-                "FF 02 00 00 00 00 00 00 00 00 00 01 FF 00 00 02", // Destination IP
-                "87",                                              // ICMPv6 neighbor advertisement.
-                "00",                                              // Code
-                "5E 94",                                           // Checksum (valid)
-                "00 00 00 00",                                     // Flags
-                "20 01 0D B8 00 00 00 00 00 00 00 00 00 00 00 02", // Target Address
-                "01",                                              // Type: Source Link-Layer Option
-                "01",                                              // Option length
-                "08 00 27 FE 8F 95"                                // Source Link layer address
-        );
-        NodeConnectorRef nodeConnectorRef = MDSALUtil.getNodeConnRef(dpnId, "0xfffffffd");
-        verify(pktProcessService).transmitPacket(new TransmitPacketInputBuilder().setPayload(expectedPayload)
-                .setNode(new NodeRef(ncId)).setEgress(nodeRef).setIngress(nodeConnectorRef).build());
-    }
-}
index 7678223a85d954e2eccf898dd058b09d386fdceb..b956f3649cef5ccb5ab05a6fd827060d773593e6 100644 (file)
@@ -21,16 +21,18 @@ import org.junit.Before;
 import org.junit.Test;
 import org.mockito.Mockito;
 import org.opendaylight.controller.md.sal.binding.api.NotificationPublishService;
+import org.opendaylight.genius.ipv6util.api.Ipv6Util;
 import org.opendaylight.genius.mdsalutil.NwConstants;
 import org.opendaylight.genius.mdsalutil.actions.ActionNxResubmit;
-import org.opendaylight.netvirt.ipv6service.utils.Ipv6Constants;
-import org.opendaylight.netvirt.ipv6service.utils.Ipv6ServiceUtils;
+import org.opendaylight.netvirt.ipv6service.utils.Ipv6ServiceConstants;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpPrefix;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6Address;
 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.action.types.rev131112.action.list.Action;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.ipv6.nd.util.rev170210.NaReceived;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.ipv6.nd.util.rev170210.NaReceivedBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorRef;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeId;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeRef;
@@ -39,8 +41,6 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.N
 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeKey;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.Metadata;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.MetadataBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.ipv6service.ipv6util.rev170210.NaReceived;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.ipv6service.ipv6util.rev170210.NaReceivedBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.packet.service.rev130709.PacketProcessingService;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.packet.service.rev130709.PacketReceived;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.packet.service.rev130709.PacketReceivedBuilder;
@@ -233,7 +233,7 @@ public class Ipv6PktHandlerTest {
         when(ifMgrInstance.getRouterV6InterfaceForNetwork(any())).thenReturn(routerIntf);
         List<Ipv6Address> ipv6AddrList = new ArrayList<>();
         when(routerIntf.getMacAddress()).thenReturn("08:00:27:FE:8F:95");
-        Ipv6Address llAddr = Ipv6ServiceUtils.getIpv6LinkLocalAddressFromMac(new MacAddress("08:00:27:FE:8F:95"));
+        Ipv6Address llAddr = Ipv6Util.getIpv6LinkLocalAddressFromMac(new MacAddress("08:00:27:FE:8F:95"));
         ipv6AddrList.add(llAddr);
         when(routerIntf.getIpv6Addresses()).thenReturn(ipv6AddrList);
 
@@ -309,7 +309,7 @@ public class Ipv6PktHandlerTest {
 
         VirtualSubnet v6Subnet = VirtualSubnet.builder().gatewayIp(gwIpAddress)
                 .subnetCidr(new IpPrefix("2001:db8::/64".toCharArray()))
-                .ipv6AddressMode(Ipv6Constants.IPV6_SLAAC).ipv6RAMode(Ipv6Constants.IPV6_SLAAC).build();
+                .ipv6AddressMode(Ipv6ServiceConstants.IPV6_SLAAC).ipv6RAMode(Ipv6ServiceConstants.IPV6_SLAAC).build();
 
         VirtualRouter virtualRouter = VirtualRouter.builder().build();
         v6Subnet.setRouter(virtualRouter);
@@ -400,20 +400,20 @@ public class Ipv6PktHandlerTest {
 
         VirtualSubnet v6Subnet1 = VirtualSubnet.builder().gatewayIp(gwIpAddress)
                 .subnetCidr(new IpPrefix("2001:db8:1111::/64".toCharArray()))
-                .ipv6AddressMode(Ipv6Constants.IPV6_SLAAC).ipv6RAMode(Ipv6Constants.IPV6_SLAAC).build();
+                .ipv6AddressMode(Ipv6ServiceConstants.IPV6_SLAAC).ipv6RAMode(Ipv6ServiceConstants.IPV6_SLAAC).build();
         VirtualRouter virtualRouter = VirtualRouter.builder().build();
         v6Subnet1.setRouter(virtualRouter);
 
         VirtualSubnet v6Subnet2 = VirtualSubnet.builder().gatewayIp(gwIpAddress)
                 .subnetCidr(new IpPrefix("2001:db8:2222::/64".toCharArray()))
-                .ipv6AddressMode(Ipv6Constants.IPV6_DHCPV6_STATELESS).ipv6RAMode(Ipv6Constants.IPV6_DHCPV6_STATELESS)
-                .build();
+                .ipv6AddressMode(Ipv6ServiceConstants.IPV6_DHCPV6_STATELESS)
+                .ipv6RAMode(Ipv6ServiceConstants.IPV6_DHCPV6_STATELESS).build();
         v6Subnet2.setRouter(virtualRouter);
 
         VirtualSubnet v6Subnet3 = VirtualSubnet.builder().gatewayIp(gwIpAddress)
                 .subnetCidr(new IpPrefix("2001:db8:3333::/64".toCharArray()))
-                .ipv6AddressMode(Ipv6Constants.IPV6_DHCPV6_STATEFUL).ipv6RAMode(Ipv6Constants.IPV6_DHCPV6_STATEFUL)
-                .build();
+                .ipv6AddressMode(Ipv6ServiceConstants.IPV6_DHCPV6_STATEFUL)
+                .ipv6RAMode(Ipv6ServiceConstants.IPV6_DHCPV6_STATEFUL).build();
         v6Subnet3.setRouter(virtualRouter);
 
         List<VirtualSubnet> subnetList = new ArrayList<>();
index 9bc133853604b078c011ab72244a39ee89d85d3c..6df33cceb99d00ef20cd67944041f8fa20f22d96 100644 (file)
@@ -11,6 +11,7 @@ package org.opendaylight.netvirt.ipv6service.utils;
 import static org.junit.Assert.assertEquals;
 
 import org.junit.Test;
+import org.opendaylight.genius.ipv6util.api.Ipv6Util;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6Address;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress;
 
@@ -31,23 +32,23 @@ public class Ipv6ServiceUtilsTest {
     public void testgetIpv6LinkLocalAddressFromMac() {
         MacAddress mac = new MacAddress("fa:16:3e:4e:18:0c");
         Ipv6Address expectedLinkLocalAddress = new Ipv6Address(IPv6_ADDR_1);
-        assertEquals(expectedLinkLocalAddress, Ipv6ServiceUtils.getIpv6LinkLocalAddressFromMac(mac));
+        assertEquals(expectedLinkLocalAddress, Ipv6Util.getIpv6LinkLocalAddressFromMac(mac));
 
         mac = new MacAddress("fa:16:3e:4e:18:c0");
         expectedLinkLocalAddress = new Ipv6Address(IPv6_ADDR_2);
-        assertEquals(expectedLinkLocalAddress, Ipv6ServiceUtils.getIpv6LinkLocalAddressFromMac(mac));
+        assertEquals(expectedLinkLocalAddress, Ipv6Util.getIpv6LinkLocalAddressFromMac(mac));
 
         mac = new MacAddress("0a:16:03:04:08:0c");
         expectedLinkLocalAddress = new Ipv6Address(IPv6_ADDR_3);
-        assertEquals(expectedLinkLocalAddress, Ipv6ServiceUtils.getIpv6LinkLocalAddressFromMac(mac));
+        assertEquals(expectedLinkLocalAddress, Ipv6Util.getIpv6LinkLocalAddressFromMac(mac));
 
         mac = new MacAddress("f4:00:00:0f:00:6b");
         expectedLinkLocalAddress = new Ipv6Address(IPv6_ADDR_4);
-        assertEquals(expectedLinkLocalAddress, Ipv6ServiceUtils.getIpv6LinkLocalAddressFromMac(mac));
+        assertEquals(expectedLinkLocalAddress, Ipv6Util.getIpv6LinkLocalAddressFromMac(mac));
 
         mac = new MacAddress("50:7B:9D:78:54:F3");
         expectedLinkLocalAddress = new Ipv6Address(IPv6_ADDR_5);
-        assertEquals(expectedLinkLocalAddress, Ipv6ServiceUtils.getIpv6LinkLocalAddressFromMac(mac));
+        assertEquals(expectedLinkLocalAddress, Ipv6Util.getIpv6LinkLocalAddressFromMac(mac));
     }
 
     /**
@@ -57,15 +58,15 @@ public class Ipv6ServiceUtilsTest {
     public void testgetIpv6SolicitedNodeMcastAddress() {
         Ipv6Address ipv6Address = new Ipv6Address(IPv6_ADDR_1);
         Ipv6Address expectedSolicitedNodeAddr = new Ipv6Address("ff02:0:0:0:0:1:ff4e:180c");
-        assertEquals(expectedSolicitedNodeAddr, Ipv6ServiceUtils.getIpv6SolicitedNodeMcastAddress(ipv6Address));
+        assertEquals(expectedSolicitedNodeAddr, Ipv6Util.getIpv6SolicitedNodeMcastAddress(ipv6Address));
 
         ipv6Address = new Ipv6Address(IPv6_ADDR_2);
         expectedSolicitedNodeAddr = new Ipv6Address("ff02:0:0:0:0:1:ff4e:18c0");
-        assertEquals(expectedSolicitedNodeAddr, Ipv6ServiceUtils.getIpv6SolicitedNodeMcastAddress(ipv6Address));
+        assertEquals(expectedSolicitedNodeAddr, Ipv6Util.getIpv6SolicitedNodeMcastAddress(ipv6Address));
 
         ipv6Address = new Ipv6Address(IPv6_ADDR_4);
         expectedSolicitedNodeAddr = new Ipv6Address("ff02:0:0:0:0:1:ff0f:6b");
-        assertEquals(expectedSolicitedNodeAddr, Ipv6ServiceUtils.getIpv6SolicitedNodeMcastAddress(ipv6Address));
+        assertEquals(expectedSolicitedNodeAddr, Ipv6Util.getIpv6SolicitedNodeMcastAddress(ipv6Address));
     }
 
     /**
@@ -75,14 +76,14 @@ public class Ipv6ServiceUtilsTest {
     public void testgetIpv6MulticastMacAddress() {
         Ipv6Address ipv6Address = new Ipv6Address(IPv6_ADDR_1);
         MacAddress expectedMacAddress = new MacAddress("33:33:fe:4e:18:0c");
-        assertEquals(expectedMacAddress, Ipv6ServiceUtils.getIpv6MulticastMacAddress(ipv6Address));
+        assertEquals(expectedMacAddress, Ipv6Util.getIpv6MulticastMacAddress(ipv6Address));
 
         ipv6Address = new Ipv6Address(IPv6_ADDR_2);
         expectedMacAddress = new MacAddress("33:33:fe:4e:18:c0");
-        assertEquals(expectedMacAddress, Ipv6ServiceUtils.getIpv6MulticastMacAddress(ipv6Address));
+        assertEquals(expectedMacAddress, Ipv6Util.getIpv6MulticastMacAddress(ipv6Address));
 
         ipv6Address = new Ipv6Address(IPv6_ADDR_4);
         expectedMacAddress = new MacAddress("33:33:fe:0f:00:6b");
-        assertEquals(expectedMacAddress, Ipv6ServiceUtils.getIpv6MulticastMacAddress(ipv6Address));
+        assertEquals(expectedMacAddress, Ipv6Util.getIpv6MulticastMacAddress(ipv6Address));
     }
 }
index af0da925eb18139c93a0846fd0339e0b8c8a0190..efd216ce92873270d17472ab4b94509f12285d86 100644 (file)
@@ -92,9 +92,9 @@ and is available at http://www.eclipse.org/legal/epl-v10.html
             <version>${project.version}</version>
         </dependency>
         <dependency>
-            <groupId>${project.groupId}</groupId>
-            <artifactId>ipv6service-api</artifactId>
-            <version>${project.version}</version>
+            <groupId>org.opendaylight.genius</groupId>
+            <artifactId>ipv6util-api</artifactId>
+            <version>${genius.version}</version>
         </dependency>
 
         <!-- Testing dependencies -->
index 0dedba0a11ca426b90bcd85bb2cd43b7bc4ce32f..a8511a2804c00a83306a6c480f1062cb038f19e8 100644 (file)
@@ -44,8 +44,8 @@ import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.
 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.genius.interfacemanager.rev160406.IfTunnel;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rpcs.rev160406.OdlInterfaceRpcService;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.ipv6.nd.util.rev170210.Ipv6NdUtilService;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.tag.name.map.ElanTagName;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.ipv6service.ipv6util.rev170210.Ipv6NdutilService;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.subnet.op.data.SubnetOpDataEntry;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.vpn.id.to.vpn.instance.VpnIds;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.natservice.rev160111.ext.routers.Routers;
@@ -69,20 +69,20 @@ public class SubnetRoutePacketInHandler implements PacketProcessingListener {
     private final ICentralizedSwitchProvider centralizedSwitchProvider;
     private final IInterfaceManager interfaceManager;
     private final VpnManagerCounters vpnManagerCounters;
-    private final Ipv6NdutilService ipv6NdutilService;
+    private final Ipv6NdUtilService ipv6NdUtilService;
 
     @Inject
     public SubnetRoutePacketInHandler(final DataBroker dataBroker, final PacketProcessingService packetService,
             final OdlInterfaceRpcService odlInterfaceRpcService,
             final ICentralizedSwitchProvider centralizedSwitchProvider, final IInterfaceManager interfaceManager,
-            VpnManagerCounters vpnManagerCounters, final Ipv6NdutilService ipv6NdutilService) {
+            VpnManagerCounters vpnManagerCounters, final Ipv6NdUtilService ipv6NdUtilService) {
         this.dataBroker = dataBroker;
         this.packetService = packetService;
         this.odlInterfaceRpcService = odlInterfaceRpcService;
         this.centralizedSwitchProvider = centralizedSwitchProvider;
         this.interfaceManager = interfaceManager;
         this.vpnManagerCounters = vpnManagerCounters;
-        this.ipv6NdutilService = ipv6NdutilService;
+        this.ipv6NdUtilService = ipv6NdUtilService;
     }
 
     @Override
@@ -278,7 +278,7 @@ public class SubnetRoutePacketInHandler implements PacketProcessingListener {
                     dstIpAddress, dpnId, elanTag);
             vpnManagerCounters.subnetRoutePacketNsSent();
 
-            VpnUtil.sendNeighborSolicationToOfGroup(this.ipv6NdutilService, new Ipv6Address(sourceIpAddress),
+            VpnUtil.sendNeighborSolicationToOfGroup(this.ipv6NdUtilService, new Ipv6Address(sourceIpAddress),
                     new MacAddress(sourceMac), new Ipv6Address(dstIpAddress), groupid, dpnId);
         }
     }
index e33207bddca5888305306565f236729f74db836b..1cf07c852a7f0854ee5d7dafad61fa598e9591e5 100644 (file)
@@ -110,6 +110,10 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rpc
 import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rpcs.rev160406.GetInterfaceFromIfIndexOutput;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rpcs.rev160406.OdlInterfaceRpcService;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.servicebinding.rev160406.service.bindings.services.info.BoundServices;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.ipv6.nd.util.rev170210.Ipv6NdUtilService;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.ipv6.nd.util.rev170210.SendNeighborSolicitationToOfGroupInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.ipv6.nd.util.rev170210.SendNeighborSolicitationToOfGroupInputBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.ipv6.nd.util.rev170210.SendNeighborSolicitationToOfGroupOutput;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.lockmanager.rev160413.LockManagerService;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.lockmanager.rev160413.TimeUnits;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.lockmanager.rev160413.TryLockInput;
@@ -140,10 +144,6 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.fibmanager.rev15033
 import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.fibmanager.rev150330.fibentries.VrfTablesKey;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.fibmanager.rev150330.vrfentries.VrfEntry;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.fibmanager.rev150330.vrfentries.VrfEntryKey;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.ipv6service.ipv6util.rev170210.Ipv6NdutilService;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.ipv6service.ipv6util.rev170210.SendNeighborSolicitationToOfGroupInput;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.ipv6service.ipv6util.rev170210.SendNeighborSolicitationToOfGroupInputBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.ipv6service.ipv6util.rev170210.SendNeighborSolicitationToOfGroupOutput;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3nexthop.rev150409.L3nexthop;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3nexthop.rev150409.l3nexthop.VpnNexthops;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3nexthop.rev150409.l3nexthop.VpnNexthopsKey;
@@ -2315,13 +2315,13 @@ public final class VpnUtil {
         }
     }
 
-    public static void sendNeighborSolicationToOfGroup(Ipv6NdutilService ipv6NdutilService, Ipv6Address srcIpv6Address,
+    public static void sendNeighborSolicationToOfGroup(Ipv6NdUtilService ipv6NdUtilService, Ipv6Address srcIpv6Address,
             MacAddress srcMac, Ipv6Address dstIpv6Address, Long ofGroupId, BigInteger dpId) {
         SendNeighborSolicitationToOfGroupInput input = new SendNeighborSolicitationToOfGroupInputBuilder()
                 .setSourceIpv6(srcIpv6Address).setSourceLlAddress(srcMac).setTargetIpAddress(dstIpv6Address)
                 .setOfGroupId(ofGroupId).setDpId(dpId).build();
         try {
-            Future<RpcResult<SendNeighborSolicitationToOfGroupOutput>> result = ipv6NdutilService
+            Future<RpcResult<SendNeighborSolicitationToOfGroupOutput>> result = ipv6NdUtilService
                     .sendNeighborSolicitationToOfGroup(input);
             RpcResult<SendNeighborSolicitationToOfGroupOutput> rpcResult = result.get();
             if (!rpcResult.isSuccessful()) {
index 18a3e267db4d5e3468f50e382b27a1969a2d6002..ea0b22d40c0f28e68fbd8a1426127fef4730d235 100644 (file)
@@ -16,14 +16,14 @@ import org.opendaylight.genius.interfacemanager.interfaces.IInterfaceManager;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.idmanager.rev160406.IdManagerService;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.ipv6service.ipv6util.rev170210.Ipv6NdutilListener;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.ipv6service.ipv6util.rev170210.NaReceived;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.ipv6.nd.util.rev170210.Ipv6NdUtilListener;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.ipv6.nd.util.rev170210.NaReceived;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.vpn.config.rev161130.VpnConfig;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 @Singleton
-public class Ipv6NaNotificationHandler extends AbstractIpLearnNotificationHandler implements Ipv6NdutilListener {
+public class Ipv6NaNotificationHandler extends AbstractIpLearnNotificationHandler implements Ipv6NdUtilListener {
 
     private static final Logger LOG = LoggerFactory.getLogger(Ipv6NaNotificationHandler.class);
 
index 6fb21aaeadb2f39b408985e11d02e0393536ac0c..cdbd530d0bb2faf91d95ad1b4e070ca561e55d0b 100644 (file)
@@ -48,8 +48,8 @@
                    interface="org.opendaylight.yang.gen.v1.urn.opendaylight.genius.alivenessmonitor.rev160411.AlivenessMonitorService" />
   <odl:rpc-service id="itmRpcService"
                    interface="org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rpcs.rev160406.ItmRpcService"/>
-  <odl:rpc-service id="ipv6NdutilService"
-                   interface="org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.ipv6service.ipv6util.rev170210.Ipv6NdutilService"/>
+  <odl:rpc-service id="ipv6NdUtilService"
+                   interface="org.opendaylight.yang.gen.v1.urn.opendaylight.genius.ipv6.nd.util.rev170210.Ipv6NdUtilService"/>
 
   <service ref="dpnInVpnChangeListener" odl:type="default"
            interface="org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.OdlL3vpnListener" />
@@ -75,7 +75,7 @@
   <odl:notification-listener ref="arpNotificationHandler" />
 
   <service ref="ipv6NaNotificationHandler" odl:type="default"
-           interface="org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.ipv6service.ipv6util.rev170210.Ipv6NdutilListener" />
+           interface="org.opendaylight.yang.gen.v1.urn.opendaylight.genius.ipv6.nd.util.rev170210.Ipv6NdUtilListener" />
   <odl:notification-listener ref="ipv6NaNotificationHandler" />
 
   <service ref="vpnManagerImpl"