use of org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.IfL2vlanBuilder in project genius by opendaylight.
the class InterfaceManagerTestUtil method buildInterface.
static Interface buildInterface(String ifName, String desc, boolean enabled, Object ifType, String parentInterface, IfL2vlan.L2vlanMode l2vlanMode) {
InterfaceBuilder builder = new InterfaceBuilder().setKey(new InterfaceKey(ifName)).setName(ifName).setDescription(desc).setEnabled(enabled).setType((Class<? extends InterfaceType>) ifType);
ParentRefs parentRefs = new ParentRefsBuilder().setParentInterface(parentInterface).build();
builder.addAugmentation(ParentRefs.class, parentRefs);
if (ifType.equals(L2vlan.class)) {
IfL2vlanBuilder ifL2vlanBuilder = new IfL2vlanBuilder().setL2vlanMode(l2vlanMode);
if (IfL2vlan.L2vlanMode.TrunkMember.equals(l2vlanMode)) {
ifL2vlanBuilder.setVlanId(new VlanId(100));
} else {
ifL2vlanBuilder.setVlanId(VlanId.getDefaultInstance("0"));
}
builder.addAugmentation(IfL2vlan.class, ifL2vlanBuilder.build());
} else if (ifType.equals(IfTunnel.class)) {
IfTunnel tunnel = new IfTunnelBuilder().setTunnelDestination(null).setTunnelGateway(null).setTunnelSource(null).setTunnelInterfaceType(null).build();
builder.addAugmentation(IfTunnel.class, tunnel);
}
return builder.build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.IfL2vlanBuilder in project netvirt by opendaylight.
the class CoeUtils method buildInterface.
static org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.Interface buildInterface(String interfaceName) {
IfL2vlan.L2vlanMode l2VlanMode = IfL2vlan.L2vlanMode.Trunk;
InterfaceBuilder interfaceBuilder = new InterfaceBuilder();
IfL2vlanBuilder ifL2vlanBuilder = new IfL2vlanBuilder();
ifL2vlanBuilder.setL2vlanMode(l2VlanMode);
interfaceBuilder.setEnabled(true).setName(interfaceName).setType(L2vlan.class).addAugmentation(IfL2vlan.class, ifL2vlanBuilder.build());
return interfaceBuilder.build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.IfL2vlanBuilder 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();
}
Aggregations