use of org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.port.mod.port.Port in project netvirt by opendaylight.
the class ElanUtils method setupTermDmacFlows.
/**
* Installs a Flow in INTERNAL_TUNNEL_TABLE of the affected DPN that sends
* the packet through the specified interface if the tunnel_id matches the
* interface's lportTag.
*
* @param interfaceInfo
* the interface info
* @param mdsalApiManager
* the mdsal API manager
* @param writeFlowGroupTx
* the writeFLowGroup tx
*/
public void setupTermDmacFlows(InterfaceInfo interfaceInfo, IMdsalApiManager mdsalApiManager, WriteTransaction writeFlowGroupTx) {
BigInteger dpId = interfaceInfo.getDpId();
int lportTag = interfaceInfo.getInterfaceTag();
Flow flow = MDSALUtil.buildFlowNew(NwConstants.INTERNAL_TUNNEL_TABLE, getIntTunnelTableFlowRef(NwConstants.INTERNAL_TUNNEL_TABLE, lportTag), 5, String.format("%s:%d", "ITM Flow Entry ", lportTag), 0, 0, ITMConstants.COOKIE_ITM.add(BigInteger.valueOf(lportTag)), getTunnelIdMatchForFilterEqualsLPortTag(lportTag), getInstructionsInPortForOutGroup(interfaceInfo.getInterfaceName()));
mdsalApiManager.addFlowToTx(dpId, flow, writeFlowGroupTx);
LOG.debug("Terminating service table flow entry created on dpn:{} for logical Interface port:{}", dpId, interfaceInfo.getPortName());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.port.mod.port.Port in project netvirt by opendaylight.
the class IfMgr method transmitRouterAdvertisement.
private void transmitRouterAdvertisement(VirtualPort intf, Ipv6RtrAdvertType advType) {
Ipv6RouterAdvt ipv6RouterAdvert = new Ipv6RouterAdvt(packetService);
LOG.debug("in transmitRouterAdvertisement for {}", advType);
VirtualNetwork vnet = getNetwork(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);
}
}
}
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.port.mod.port.Port in project netvirt by opendaylight.
the class IfMgr method removePort.
public void removePort(Uuid portId) {
VirtualPort intf = portId != null ? vintfs.remove(portId) : null;
if (intf != null) {
intf.removeSelf();
Uuid networkID = intf.getNetworkID();
if (intf.getDeviceOwner().equalsIgnoreCase(Ipv6Constants.NETWORK_ROUTER_INTERFACE)) {
LOG.info("In removePort for router interface, portId {}", portId);
if (networkID != null) {
vrouterv6IntfMap.remove(networkID, intf);
}
/* Router port is deleted. Remove the corresponding icmpv6 punt flows on all
the dpnIds which were hosting the VMs on the network.
*/
programIcmpv6RSPuntFlows(intf, Ipv6Constants.DEL_FLOW);
for (Ipv6Address ipv6Address : intf.getIpv6Addresses()) {
programIcmpv6NSPuntFlowForAddress(intf, ipv6Address, Ipv6Constants.DEL_FLOW);
}
transmitRouterAdvertisement(intf, Ipv6RtrAdvertType.CEASE_ADVERTISEMENT);
timer.cancelPeriodicTransmissionTimeout(intf.getPeriodicTimeout());
intf.resetPeriodicTimeout();
LOG.debug("Reset the periodic RA Timer for intf {}", intf.getIntfUUID());
} else {
LOG.info("In removePort for host interface, portId {}", portId);
// Remove the serviceBinding entry for the port.
ipv6ServiceUtils.unbindIpv6Service(portId.getValue());
// Remove the portId from the (network <--> List[dpnIds, List <ports>]) cache.
VirtualNetwork vnet = getNetwork(networkID);
if (null != vnet) {
BigInteger dpId = intf.getDpId();
vnet.updateDpnPortInfo(dpId, intf.getOfPort(), Ipv6Constants.DEL_ENTRY);
}
}
}
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.port.mod.port.Port in project netvirt by opendaylight.
the class IfMgr method addHostIntf.
public void addHostIntf(Uuid portId, Uuid snetId, Uuid networkId, IpAddress fixedIp, String macAddress, String deviceOwner) {
LOG.debug("addHostIntf portId {}, snetId {}, networkId {}, ip {}, mac {}", portId, snetId, networkId, fixedIp, macAddress);
// Save the interface ipv6 address in its fully expanded format
Ipv6Address addr = new Ipv6Address(InetAddresses.forString(fixedIp.getIpv6Address().getValue()).getHostAddress());
fixedIp = new IpAddress(addr);
VirtualPort intf = VirtualPort.builder().intfUUID(portId).networkID(networkId).macAddress(macAddress).routerIntfFlag(false).deviceOwner(deviceOwner).build();
intf.setSubnetInfo(snetId, fixedIp);
VirtualPort prevIntf = vintfs.putIfAbsent(portId, intf);
if (prevIntf == null) {
Long elanTag = getNetworkElanTag(networkId);
// Do service binding for the port and set the serviceBindingStatus to true.
ipv6ServiceUtils.bindIpv6Service(portId.getValue(), elanTag, NwConstants.IPV6_TABLE);
intf.setServiceBindingStatus(true);
/* Update the intf dpnId/ofPort from the Operational Store */
updateInterfaceDpidOfPortInfo(portId);
} else {
intf = prevIntf;
intf.setSubnetInfo(snetId, fixedIp);
}
VirtualSubnet snet = getSubnet(snetId);
if (snet != null) {
intf.setSubnet(snetId, snet);
} else {
addUnprocessed(unprocessedSubnetIntfs, snetId, intf);
}
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.port.mod.port.Port in project netvirt by opendaylight.
the class IfMgr method updateInterfaceDpidOfPortInfo.
public void updateInterfaceDpidOfPortInfo(Uuid portId) {
LOG.debug("In updateInterfaceDpidOfPortInfo portId {}", portId);
Interface interfaceState = ipv6ServiceUtils.getInterfaceStateFromOperDS(portId.getValue());
if (interfaceState == null) {
LOG.warn("In updateInterfaceDpidOfPortInfo, port info not found in Operational Store {}.", portId);
return;
}
List<String> ofportIds = interfaceState.getLowerLayerIf();
NodeConnectorId nodeConnectorId = new NodeConnectorId(ofportIds.get(0));
BigInteger dpId = BigInteger.valueOf(MDSALUtil.getDpnIdFromPortName(nodeConnectorId));
if (!dpId.equals(Ipv6Constants.INVALID_DPID)) {
Long ofPort = MDSALUtil.getOfPortNumberFromPortName(nodeConnectorId);
updateDpnInfo(portId, dpId, ofPort);
}
}
Aggregations