// Update the network <--> List[dpnIds, List<ports>] cache.
VirtualNetwork vnet = vnetworks.get(intf.getNetworkID());
if (null != vnet) {
- vnet.updateDpnPortInfo(dpId, portId, Ipv6Constants.ADD_ENTRY);
+ vnet.updateDpnPortInfo(dpId, ofPort, Ipv6Constants.ADD_ENTRY);
}
return;
VirtualNetwork vnet = vnetworks.get(intf.getNetworkID());
if (null != vnet) {
BigInteger dpId = ipv6ServiceUtils.getDataPathId(intf.getDpId());
- vnet.updateDpnPortInfo(dpId, intf.getIntfUUID(), Ipv6Constants.DEL_ENTRY);
+ vnet.updateDpnPortInfo(dpId, intf.getOfPort(), Ipv6Constants.DEL_ENTRY);
}
}
vintfs.remove(portId);
Ipv6RouterAdvt ipv6RouterAdvert = new Ipv6RouterAdvt();
LOG.debug("in transmitRouterAdvertisement for {}", advType);
- for (VirtualPort port : vintfs.values()) {
- if ((port.getOfPort() != null) && (port.getNetworkID() != null)
- && (port.getNetworkID().equals(intf.getNetworkID()))) {
-
- String nodeName = Ipv6Constants.OPENFLOW_NODE_PREFIX + port.getDpId();
- String outPort = nodeName + ":" + port.getOfPort();
- LOG.debug("Transmitting RA {} for node {}, port {}", advType, nodeName, outPort);
- InstanceIdentifier<NodeConnector> outPortId = InstanceIdentifier.builder(Nodes.class)
- .child(Node.class, new NodeKey(new NodeId(nodeName)))
- .child(NodeConnector.class,
- new NodeConnectorKey(new NodeConnectorId(outPort)))
- .build();
- ipv6RouterAdvert.transmitRtrAdvertisement(advType, intf, new NodeConnectorRef(outPortId), null);
+ VirtualNetwork vnet = vnetworks.get(intf.getNetworkID());
+ if (vnet != null) {
+ String nodeName;
+ String outPort;
+ Collection<VirtualNetwork.DpnInterfaceInfo> dpnIfaceList = vnet.getDpnIfaceList();
+ for (VirtualNetwork.DpnInterfaceInfo dpnIfaceInfo : dpnIfaceList) {
+ nodeName = Ipv6Constants.OPENFLOW_NODE_PREFIX + dpnIfaceInfo.getDpId();
+ List<NodeConnectorRef> ncRefList = new ArrayList<>();
+ for (Long ofPort: dpnIfaceInfo.ofPortList) {
+ outPort = nodeName + ":" + ofPort;
+ LOG.debug("Transmitting RA {} for node {}, port {}", advType, nodeName, outPort);
+ InstanceIdentifier<NodeConnector> outPortId = InstanceIdentifier.builder(Nodes.class)
+ .child(Node.class, new NodeKey(new NodeId(nodeName)))
+ .child(NodeConnector.class, new NodeConnectorKey(new NodeConnectorId(outPort)))
+ .build();
+ ncRefList.add(new NodeConnectorRef(outPortId));
+ }
+ if (!ncRefList.isEmpty()) {
+ ipv6RouterAdvert.transmitRtrAdvertisement(advType, intf, ncRefList, null);
+ }
}
}
}
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.ExecutorService;
import java.util.concurrent.Executors;
import org.opendaylight.controller.liblldp.BitBufferHelper;
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.inventory.rev130819.NodeConnectorRef;
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.nd.packet.rev160620.EthernetHeader;
return;
}
Ipv6RouterAdvt ipv6RouterAdvert = new Ipv6RouterAdvt();
+ List<NodeConnectorRef> ncRefList = new ArrayList<>();
+ ncRefList.add(packet.getIngress());
ipv6RouterAdvert.transmitRtrAdvertisement(Ipv6RtrAdvertType.SOLICITED_ADVERTISEMENT,
- routerPort, packet.getIngress(), rsPdu);
+ routerPort, ncRefList, rsPdu);
pktProccessedCounter = pktProccessedCounter + 1;
}
}
public boolean transmitRtrAdvertisement(Ipv6RtrAdvertType raType, VirtualPort routerPort,
- NodeConnectorRef outport, RouterSolicitationPacket rsPdu) {
+ List<NodeConnectorRef> outportList, RouterSolicitationPacket rsPdu) {
if (pktService == null) {
LOG.info("transmitRtrAdvertisement packet processing service is not yet configured");
return false;
updateRAResponse(raType, rsPdu, raPacket, routerPort);
// Serialize the response packet
byte[] txPayload = fillRouterAdvertisementPacket(raPacket.build());
- InstanceIdentifier<Node> outNode = outport.getValue().firstIdentifierOf(Node.class);
- TransmitPacketInput input = new TransmitPacketInputBuilder().setPayload(txPayload)
- .setNode(new NodeRef(outNode))
- .setEgress(outport).build();
- LOG.debug("Transmitting the Router Advt packet out {}", outport);
- pktService.transmitPacket(input);
+ for (NodeConnectorRef outport: outportList) {
+ InstanceIdentifier<Node> outNode = outport.getValue().firstIdentifierOf(Node.class);
+ TransmitPacketInput input = new TransmitPacketInputBuilder().setPayload(txPayload)
+ .setNode(new NodeRef(outNode))
+ .setEgress(outport).build();
+ LOG.debug("Transmitting the Router Advt packet out {}", outport);
+ pktService.transmitPacket(input);
+ }
return true;
}
return networkUUID;
}
- public void updateDpnPortInfo(BigInteger dpnId, Uuid portId, int addOrRemove) {
+ public void updateDpnPortInfo(BigInteger dpnId, Long ofPort, int addOrRemove) {
DpnInterfaceInfo dpnInterface = dpnIfaceList.get(dpnId);
if (dpnInterface == null) {
dpnInterface = new DpnInterfaceInfo(dpnId);
}
if (addOrRemove == Ipv6Constants.ADD_ENTRY) {
- dpnInterface.updatePort(portId);
+ dpnInterface.updateofPortList(ofPort);
} else {
- dpnInterface.removePort(portId);
+ dpnInterface.removeOfPortFromList(ofPort);
}
}
while (itr.hasNext()) {
DpnInterfaceInfo dpnInterfaceInfo = (DpnInterfaceInfo) itr.next();
if (null != dpnInterfaceInfo) {
- dpnInterfaceInfo.clearPortInfo();
+ dpnInterfaceInfo.clearOfPortList();
dpnInterfaceInfo.clearNdTargetFlowInfo();
}
}
public class DpnInterfaceInfo {
BigInteger dpId;
int rsPuntFlowConfigured;
- List<Uuid> portUUID;
+ List<Long> ofPortList;
List<Ipv6Address> ndTargetFlowsPunted;
DpnInterfaceInfo(BigInteger dpnId) {
dpId = dpnId;
- portUUID = new ArrayList<>();
+ ofPortList = new ArrayList<>();
ndTargetFlowsPunted = new ArrayList<>();
rsPuntFlowConfigured = Ipv6Constants.FLOWS_NOT_CONFIGURED;
}
this.ndTargetFlowsPunted.clear();
}
- public void updatePort(Uuid portID) {
- this.portUUID.add(portID);
+ public void updateofPortList(Long ofPort) {
+ this.ofPortList.add(ofPort);
}
- public void removePort(Uuid portID) {
- this.portUUID.remove(portID);
+ public void removeOfPortFromList(Long ofPort) {
+ this.ofPortList.remove(ofPort);
}
- public void clearPortInfo() {
- this.portUUID.clear();
+ public void clearOfPortList() {
+ this.ofPortList.clear();
}
@Override
public String toString() {
- return "DpnInterfaceInfo [dpId=" + dpId + " rsPuntFlowConfigured=" + rsPuntFlowConfigured + " portUUID="
- + portUUID + "]";
+ return "DpnInterfaceInfo [dpId=" + dpId + " rsPuntFlowConfigured=" + rsPuntFlowConfigured + " ofPortList="
+ + ofPortList + "]";
}
}
}