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;
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;
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);
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);
*/
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);
}
}
// 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);
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);
}
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) {
/* 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());
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);
}
}
}
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);
}
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;
}
}
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 {
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);
}
}
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);
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);
}
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);
}
}
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);
}
}
}
removeUnprocessedNSFlows(unprocessedNetNSFlowIntfs, networkId);
for (Ipv6Address ipv6Address : ipv6Addresses) {
- programIcmpv6NSPuntFlowForAddress(networkId, ipv6Address, Ipv6Constants.ADD_FLOW);
+ programIcmpv6NSPuntFlowForAddress(networkId, ipv6Address, Ipv6ServiceConstants.ADD_FLOW);
}
Integer action = removeUnprocessedRSFlows(unprocessedNetRSFlowIntfs, networkId);
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();
}
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());
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);
}
}
}
/* 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