use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.physical._switch.attributes.TunnelIps in project netvirt by opendaylight.
the class L2GatewayDevice method toString.
/*
* (non-Javadoc)
*
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
List<String> lstTunnelIps = new ArrayList<>();
for (IpAddress ip : this.tunnelIps) {
lstTunnelIps.add(String.valueOf(ip.getValue()));
}
List<String> lstMacs = this.ucastLocalMacs.stream().map(localUcastMac -> localUcastMac.getMacEntryKey().getValue()).collect(Collectors.toList());
return "L2GatewayDevice [deviceName=" + deviceName + ", hwvtepNodeId=" + hwvtepNodeId + ", tunnelIps=" + lstTunnelIps + ", l2GatewayIds=" + l2GatewayIds + ", ucastLocalMacs=" + lstMacs + "]";
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.physical._switch.attributes.TunnelIps in project netvirt by opendaylight.
the class NodeConnectedHandlerUtils method addPsNode.
CheckedFuture<Void, TransactionCommitFailedException> addPsNode(InstanceIdentifier<Node> path, InstanceIdentifier<Node> parentPath, List<String> portNameList, WriteTransaction transaction) throws Exception {
NodeBuilder nodeBuilder = null;
nodeBuilder = prepareOperationalNode(path);
PhysicalSwitchAugmentationBuilder physicalSwitchAugmentationBuilder = new PhysicalSwitchAugmentationBuilder();
physicalSwitchAugmentationBuilder.setManagedBy(new HwvtepGlobalRef(parentPath));
physicalSwitchAugmentationBuilder.setPhysicalSwitchUuid(getUUid("d1s3"));
physicalSwitchAugmentationBuilder.setHwvtepNodeName(new HwvtepNodeName("s3"));
physicalSwitchAugmentationBuilder.setHwvtepNodeDescription("description");
List<TunnelIps> tunnelIps = new ArrayList<>();
IpAddress ip = new IpAddress("192.168.122.30".toCharArray());
tunnelIps.add(new TunnelIpsBuilder().setKey(new TunnelIpsKey(ip)).setTunnelIpsKey(ip).build());
physicalSwitchAugmentationBuilder.setTunnelIps(tunnelIps);
nodeBuilder.addAugmentation(PhysicalSwitchAugmentation.class, physicalSwitchAugmentationBuilder.build());
PhysicalSwitchHelper.dId = parentPath;
nodeBuilder.setTerminationPoint(PhysicalSwitchHelper.addPhysicalSwitchTerminationPoints(path, transaction, portNameList));
return TestUtil.submitNode(OPERATIONAL, path, nodeBuilder.build(), transaction);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.physical._switch.attributes.TunnelIps in project genius by opendaylight.
the class IfmUtil method getEgressActionInfosForInterface.
/**
* Returns the list of egress actions for a given interface.
*
* @param interfaceInfo the interface to look up
* @param portNo port number
* @param ifaceType the type of the interface
* @param tunnelKey the tunnel key
* @param actionKeyStart the start for the first key assigned for the new actions
* @param isDefaultEgress if it is the default egress
* @param ifIndex interface index
* @param groupId group Id
* @return list of actions for the interface
*/
// The following suppression is for javac, not for checkstyle
@SuppressWarnings("fallthrough")
@SuppressFBWarnings("SF_SWITCH_FALLTHROUGH")
public static List<ActionInfo> getEgressActionInfosForInterface(Interface interfaceInfo, String portNo, InterfaceInfo.InterfaceType ifaceType, Long tunnelKey, int actionKeyStart, boolean isDefaultEgress, int ifIndex, long groupId) {
List<ActionInfo> result = new ArrayList<>();
switch(ifaceType) {
case MPLS_OVER_GRE:
// fall through
case GRE_TRUNK_INTERFACE:
if (!isDefaultEgress) {
// stores the value coming from a VXLAN tunnel
if (tunnelKey == null) {
tunnelKey = 0L;
}
}
// fall through
case VXLAN_TRUNK_INTERFACE:
if (!isDefaultEgress) {
if (tunnelKey != null) {
result.add(new ActionSetFieldTunnelId(actionKeyStart++, BigInteger.valueOf(tunnelKey)));
}
} else {
// For OF Tunnels default egress actions need to set tunnelIps
IfTunnel ifTunnel = interfaceInfo.getAugmentation(IfTunnel.class);
if (BooleanUtils.isTrue(ifTunnel.isTunnelRemoteIpFlow() && ifTunnel.getTunnelDestination() != null)) {
result.add(new ActionSetTunnelDestinationIp(actionKeyStart++, ifTunnel.getTunnelDestination()));
}
if (BooleanUtils.isTrue(ifTunnel.isTunnelSourceIpFlow() && ifTunnel.getTunnelSource() != null)) {
result.add(new ActionSetTunnelSourceIp(actionKeyStart++, ifTunnel.getTunnelSource()));
}
}
// fall through
case VLAN_INTERFACE:
if (isDefaultEgress) {
IfL2vlan vlanIface = interfaceInfo.getAugmentation(IfL2vlan.class);
LOG.trace("get egress actions for l2vlan interface: {}", vlanIface);
boolean isVlanTransparent = false;
int vlanVid = 0;
if (vlanIface != null) {
vlanVid = vlanIface.getVlanId() == null ? 0 : vlanIface.getVlanId().getValue();
isVlanTransparent = vlanIface.getL2vlanMode() == IfL2vlan.L2vlanMode.Transparent;
}
if (vlanVid != 0 && !isVlanTransparent) {
result.add(new ActionPushVlan(actionKeyStart++));
result.add(new ActionSetFieldVlanVid(actionKeyStart++, vlanVid));
}
result.add(new ActionOutput(actionKeyStart++, new Uri(portNo)));
} else {
addEgressActionInfosForInterface(ifIndex, actionKeyStart, result);
}
break;
case LOGICAL_GROUP_INTERFACE:
if (isDefaultEgress) {
result.add(new ActionGroup(groupId));
} else {
addEgressActionInfosForInterface(ifIndex, actionKeyStart, result);
}
break;
default:
LOG.warn("Interface Type {} not handled yet", ifaceType);
break;
}
return result;
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.physical._switch.attributes.TunnelIps in project netvirt by opendaylight.
the class HwvtepPhysicalSwitchListener method added.
@Override
protected void added(InstanceIdentifier<PhysicalSwitchAugmentation> identifier, final PhysicalSwitchAugmentation phySwitchAdded) {
String globalNodeId = getManagedByNodeId(identifier);
final InstanceIdentifier<Node> globalNodeIid = getManagedByNodeIid(identifier);
NodeId nodeId = getNodeId(identifier);
if (TUNNEL_IP_NOT_AVAILABLE.test(phySwitchAdded)) {
LOG.error("Could not find the /tunnel ips for node {}", nodeId.getValue());
return;
}
final String psName = getPsName(identifier);
LOG.trace("Received physical switch {} added event received for node {}", psName, nodeId.getValue());
haOpClusteredListener.runAfterNodeIsConnected(globalNodeIid, (node) -> {
LOG.trace("Running job for node {} ", globalNodeIid);
if (!node.isPresent()) {
LOG.error("Global node is absent {}", globalNodeId);
return;
}
HAOpClusteredListener.addToCacheIfHAChildNode(globalNodeIid, node.get());
if (hwvtepHACache.isHAEnabledDevice(globalNodeIid)) {
LOG.trace("Ha enabled device {}", globalNodeIid);
return;
}
LOG.trace("Updating cache for node {}", globalNodeIid);
L2GatewayDevice l2GwDevice = l2GatewayCache.get(psName);
if (childConnectedAfterParent.test(l2GwDevice, globalNodeIid)) {
LOG.trace("Device {} {} is already Connected by {}", psName, globalNodeId, l2GwDevice.getHwvtepNodeId());
return;
}
InstanceIdentifier<Node> existingIid = globalNodeIid;
if (l2GwDevice != null && l2GwDevice.getHwvtepNodeId() != null) {
existingIid = HwvtepHAUtil.convertToInstanceIdentifier(l2GwDevice.getHwvtepNodeId());
}
if (parentConnectedAfterChild.test(l2GwDevice, globalNodeIid) && alreadyHasL2Gwids.test(l2GwDevice)) {
LOG.error("Child node {} having l2gw configured became ha node " + " removing the l2device {} from all elan cache and provision parent node {}", existingIid, psName, globalNodeIid);
ElanL2GwCacheUtils.removeL2GatewayDeviceFromAllElanCache(l2GwDevice.getHwvtepNodeId());
}
l2GwDevice = l2GatewayCache.addOrGet(psName);
l2GwDevice.setConnected(true);
l2GwDevice.setHwvtepNodeId(globalNodeId);
List<TunnelIps> tunnelIps = phySwitchAdded.getTunnelIps();
if (tunnelIps != null) {
for (TunnelIps tunnelIp : tunnelIps) {
IpAddress tunnelIpAddr = tunnelIp.getTunnelIpsKey();
l2GwDevice.addTunnelIp(tunnelIpAddr);
}
}
handleAdd(l2GwDevice);
elanClusterUtils.runOnlyInOwnerNode("Update config tunnels IP ", () -> {
try {
updateConfigTunnelIp(identifier, phySwitchAdded);
} catch (ReadFailedException e) {
LOG.error("Failed to update tunnel ips {}", identifier);
}
});
return;
});
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.physical._switch.attributes.TunnelIps in project netvirt by opendaylight.
the class HwvtepPhysicalSwitchListener method handleAdd.
/**
* Handle add.
*
* @param l2GwDevice
* the l2 gw device
*/
private void handleAdd(L2GatewayDevice l2GwDevice) {
final String psName = l2GwDevice.getDeviceName();
final String hwvtepNodeId = l2GwDevice.getHwvtepNodeId();
Set<IpAddress> tunnelIps = l2GwDevice.getTunnelIps();
for (final IpAddress tunnelIpAddr : tunnelIps) {
if (L2GatewayConnectionUtils.isGatewayAssociatedToL2Device(l2GwDevice)) {
LOG.debug("L2Gateway {} associated for {} physical switch; creating ITM tunnels for {}", l2GwDevice.getL2GatewayIds(), psName, tunnelIpAddr);
l2gwServiceProvider.provisionItmAndL2gwConnection(l2GwDevice, psName, hwvtepNodeId, tunnelIpAddr);
} else {
LOG.info("l2gw.provision.skip {}:{}", hwvtepNodeId, psName);
}
}
elanClusterUtils.runOnlyInOwnerNode("Stale entry cleanup", () -> {
InstanceIdentifier<Node> globalNodeIid = HwvtepSouthboundUtils.createInstanceIdentifier(new NodeId(hwvtepNodeId));
InstanceIdentifier<Node> psIid = HwvtepSouthboundUtils.createInstanceIdentifier(HwvtepSouthboundUtils.createManagedNodeId(new NodeId(hwvtepNodeId), psName));
staleVlanBindingsCleaner.scheduleStaleCleanup(psName, globalNodeIid, psIid);
});
}
Aggregations