use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.InterfaceKey in project genius by opendaylight.
the class ItmUtils method buildTunnelInterface.
public static Interface buildTunnelInterface(BigInteger dpn, String ifName, String desc, boolean enabled, Class<? extends TunnelTypeBase> tunType, IpAddress localIp, IpAddress remoteIp, IpAddress gatewayIp, Integer vlanId, boolean internal, Boolean monitorEnabled, Class<? extends TunnelMonitoringTypeBase> monitorProtocol, Integer monitorInterval, boolean useOfTunnel, String parentIfaceName, List<TunnelOptions> tunnelOptions) {
InterfaceBuilder builder = new InterfaceBuilder().setKey(new InterfaceKey(ifName)).setName(ifName).setDescription(desc).setEnabled(enabled).setType(Tunnel.class);
ParentRefs parentRefs = new ParentRefsBuilder().setDatapathNodeIdentifier(dpn).setParentInterface(parentIfaceName).build();
builder.addAugmentation(ParentRefs.class, parentRefs);
Long monitoringInterval = null;
if (vlanId > 0) {
IfL2vlan l2vlan = new IfL2vlanBuilder().setVlanId(new VlanId(vlanId)).build();
builder.addAugmentation(IfL2vlan.class, l2vlan);
}
LOG.debug("buildTunnelInterface: monitorProtocol = {} and monitorInterval = {}", monitorProtocol.getName(), monitorInterval);
if (monitorInterval != null) {
monitoringInterval = monitorInterval.longValue();
}
IfTunnel tunnel = new IfTunnelBuilder().setTunnelDestination(remoteIp).setTunnelGateway(gatewayIp).setTunnelSource(localIp).setTunnelInterfaceType(tunType).setInternal(internal).setMonitorEnabled(monitorEnabled).setMonitorProtocol(monitorProtocol).setMonitorInterval(monitoringInterval).setTunnelRemoteIpFlow(useOfTunnel).setTunnelOptions(tunnelOptions).build();
builder.addAugmentation(IfTunnel.class, tunnel);
return builder.build();
}
use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.InterfaceKey in project genius by opendaylight.
the class ItmTunnelAggregationHelper method updateInterfaceAdminStatus.
private void updateInterfaceAdminStatus(String ifaceName, AdminStatus st, WriteTransaction tx) {
LOG.debug("MULTIPLE_VxLAN_TUNNELS: update AdminStatus to be {} for {}", st.toString(), ifaceName);
InstanceIdentifier<Interface> id = ItmUtils.buildStateInterfaceId(ifaceName);
InterfaceBuilder ifaceBuilderChild = new InterfaceBuilder();
ifaceBuilderChild.setKey(new InterfaceKey(ifaceName));
ifaceBuilderChild.setAdminStatus(st);
tx.merge(LogicalDatastoreType.OPERATIONAL, id, ifaceBuilderChild.build(), true);
}
use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.InterfaceKey in project genius by opendaylight.
the class ItmExternalTunnelAddWorker method wireUp.
// for tunnels from TOR device
private boolean wireUp(String topoId, String srcNodeid, IpAddress srcIp, String dstNodeId, IpAddress dstIp, IpPrefix srcSubnet, IpAddress gwIp, IpPrefix dstSubnet, Class<? extends TunnelTypeBase> tunType, Boolean monitorEnabled, Integer monitorInterval, Class<? extends TunnelMonitoringTypeBase> monitorProtocol, WriteTransaction transaction) {
IpAddress gatewayIpObj = IpAddressBuilder.getDefaultInstance("0.0.0.0");
IpAddress gwyIpAddress = srcSubnet.equals(dstSubnet) ? gatewayIpObj : gwIp;
String parentIf = ItmUtils.getHwParentIf(topoId, srcNodeid);
String tunTypeStr = tunType.getName();
String tunnelIfName = ItmUtils.getTrunkInterfaceName(parentIf, new String(srcIp.getValue()), new String(dstIp.getValue()), tunTypeStr);
LOG.debug(" Creating ExternalTrunk Interface with parameters Name - {}, parent I/f name - {}, " + "source IP - {}, destination IP - {} gateway IP - {}", tunnelIfName, parentIf, srcIp, dstIp, gwyIpAddress);
Interface hwTunnelIf = ItmUtils.buildHwTunnelInterface(tunnelIfName, String.format("%s %s", tunType.getName(), "Trunk Interface"), true, topoId, srcNodeid, tunType, srcIp, dstIp, gwyIpAddress, monitorEnabled, monitorProtocol, monitorInterval);
InstanceIdentifier<Interface> ifIID = InstanceIdentifier.builder(Interfaces.class).child(Interface.class, new InterfaceKey(tunnelIfName)).build();
LOG.trace(" Writing Trunk Interface to Config DS {}, {} ", ifIID, hwTunnelIf);
ItmUtils.ITM_CACHE.addInterface(hwTunnelIf);
transaction.merge(LogicalDatastoreType.CONFIGURATION, ifIID, hwTunnelIf, true);
// also update itm-state ds?
InstanceIdentifier<ExternalTunnel> path = InstanceIdentifier.create(ExternalTunnelList.class).child(ExternalTunnel.class, new ExternalTunnelKey(getExternalTunnelKey(dstNodeId), getExternalTunnelKey(srcNodeid), tunType));
ExternalTunnel tnl = ItmUtils.buildExternalTunnel(getExternalTunnelKey(srcNodeid), getExternalTunnelKey(dstNodeId), tunType, tunnelIfName);
transaction.merge(LogicalDatastoreType.CONFIGURATION, path, tnl, true);
ItmUtils.ITM_CACHE.addExternalTunnel(tnl);
return true;
}
use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.InterfaceKey in project genius by opendaylight.
the class IfmUtil method getEgressActionInfosForInterface.
/**
* Returns a list of Actions to be taken when sending a packet over an
* interface.
*
* @param interfaceName
* name of the interface
* @param tunnelKey
* Optional.
* @param actionKeyStart
* action key
* @param interfaceUtils
* InterfaceManagerCommonUtils
* @return list of actions
*/
public static List<ActionInfo> getEgressActionInfosForInterface(String interfaceName, Long tunnelKey, int actionKeyStart, InterfaceManagerCommonUtils interfaceUtils, Boolean isDefaultEgress) {
Interface interfaceInfo = interfaceUtils.getInterfaceFromConfigDS(new InterfaceKey(interfaceName));
if (interfaceInfo == null) {
throw new NullPointerException("Interface information not present in config DS for " + interfaceName);
}
org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.Interface ifState = interfaceUtils.getInterfaceState(interfaceName);
if (ifState == null) {
throw new NullPointerException("Interface information not present in oper DS for " + interfaceName);
}
String lowerLayerIf = ifState.getLowerLayerIf().get(0);
NodeConnectorId nodeConnectorId = new NodeConnectorId(lowerLayerIf);
String portNo = IfmUtil.getPortNoFromNodeConnectorId(nodeConnectorId);
InterfaceInfo.InterfaceType ifaceType = getInterfaceType(interfaceInfo);
return getEgressActionInfosForInterface(interfaceInfo, portNo, ifaceType, tunnelKey, actionKeyStart, isDefaultEgress, ifState.getIfIndex(), 0);
}
use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.InterfaceKey in project genius by opendaylight.
the class IfmUtil method updateInterfaceParentRef.
public static void updateInterfaceParentRef(WriteTransaction writeTransaction, String interfaceName, String parentInterface) {
InstanceIdentifier<ParentRefs> parentRefIdentifier = InstanceIdentifier.builder(Interfaces.class).child(Interface.class, new InterfaceKey(interfaceName)).augmentation(ParentRefs.class).build();
ParentRefs parentRefs = new ParentRefsBuilder().setParentInterface(parentInterface).build();
writeTransaction.merge(LogicalDatastoreType.CONFIGURATION, parentRefIdentifier, parentRefs);
LOG.debug("Updating parentRefInterface for interfaceName {}. " + "interfaceKey {}, with parentRef augmentation pointing to {}", interfaceName, new InterfaceKey(interfaceName), parentInterface);
}
Aggregations