use of org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.interfaces._interface.NodeIdentifierBuilder in project genius by opendaylight.
the class ItmUtils method buildHwTunnelInterface.
public static Interface buildHwTunnelInterface(String tunnelIfName, String desc, boolean enabled, String topoId, String nodeId, Class<? extends TunnelTypeBase> tunType, IpAddress srcIp, IpAddress destIp, IpAddress gwIp, Boolean monitorEnabled, Class<? extends TunnelMonitoringTypeBase> monitorProtocol, Integer monitorInterval) {
InterfaceBuilder builder = new InterfaceBuilder().setKey(new InterfaceKey(tunnelIfName)).setName(tunnelIfName).setDescription(desc).setEnabled(enabled).setType(Tunnel.class);
List<NodeIdentifier> nodeIds = new ArrayList<>();
NodeIdentifier hwNode = new NodeIdentifierBuilder().setKey(new NodeIdentifierKey(topoId)).setTopologyId(topoId).setNodeId(nodeId).build();
nodeIds.add(hwNode);
ParentRefs parent = new ParentRefsBuilder().setNodeIdentifier(nodeIds).build();
builder.addAugmentation(ParentRefs.class, parent);
IfTunnel tunnel = new IfTunnelBuilder().setTunnelDestination(destIp).setTunnelGateway(gwIp).setTunnelSource(srcIp).setMonitorEnabled(monitorEnabled == null || monitorEnabled).setMonitorProtocol(monitorProtocol == null ? ITMConstants.DEFAULT_MONITOR_PROTOCOL : monitorProtocol).setMonitorInterval(DEFAULT_MONITORING_INTERVAL).setTunnelInterfaceType(tunType).setInternal(false).build();
builder.addAugmentation(IfTunnel.class, tunnel);
LOG.trace("iftunnel {} built from hwvtep {} ", tunnel, nodeId);
return builder.build();
}
Aggregations