use of org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.IfL2vlan in project genius by opendaylight.
the class IfmCLIUtil method showVlanOutput.
static void showVlanOutput(InterfaceInfo ifaceInfo, Interface iface, CommandSession session) {
StringBuilder sb = new StringBuilder();
Formatter fmt = new Formatter(sb);
IfL2vlan l2vlan = iface.getAugmentation(IfL2vlan.class);
int vlanId = l2vlan != null ? l2vlan.getVlanId() != null ? l2vlan.getVlanId().getValue() : 0 : 0;
session.getConsole().println(fmt.format(VLAN_OUTPUT_FORMAT_LINE1, iface.getName()));
sb.setLength(0);
session.getConsole().println(fmt.format(VLAN_OUTPUT_FORMAT, "", ifaceInfo == null ? UNSET : ifaceInfo.getDpId(), ifaceInfo == null ? UNSET : ifaceInfo.getPortName(), vlanId));
sb.setLength(0);
session.getConsole().println(fmt.format(VLAN_OUTPUT_FORMAT, ifaceInfo == null ? UNSET : ifaceInfo.getInterfaceTag(), ifaceInfo == null ? UNSET : ifaceInfo.getPortNo(), ifaceInfo == null ? UNSET : ifaceInfo.getAdminState(), ifaceInfo == null ? UNSET : ifaceInfo.getOpState()));
sb.setLength(0);
session.getConsole().println(fmt.format(VLAN_OUTPUT_FORMAT + "%n", iface.getDescription(), "", "", ""));
sb.setLength(0);
fmt.close();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.IfL2vlan in project genius by opendaylight.
the class VlanMemberConfigListener method add.
@Override
public void add(@Nonnull Interface newInterface) {
IfL2vlan ifL2vlan = newInterface.getAugmentation(IfL2vlan.class);
if (ifL2vlan == null || IfL2vlan.L2vlanMode.TrunkMember != ifL2vlan.getL2vlanMode()) {
return;
}
addVlanMember(newInterface);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.IfL2vlan in project genius by opendaylight.
the class VlanMemberConfigListener method remove.
@Override
public void remove(@Nonnull Interface removedInterface) {
IfL2vlan ifL2vlan = removedInterface.getAugmentation(IfL2vlan.class);
if (ifL2vlan == null || IfL2vlan.L2vlanMode.TrunkMember != ifL2vlan.getL2vlanMode()) {
return;
}
removeVlanMember(removedInterface);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.IfL2vlan in project genius by opendaylight.
the class InterfaceServiceUtil method getVlanId.
public static short getVlanId(String interfaceName, DataBroker broker) {
InstanceIdentifier<Interface> id = InstanceIdentifier.builder(Interfaces.class).child(Interface.class, new InterfaceKey(interfaceName)).build();
Optional<Interface> ifInstance = MDSALUtil.read(LogicalDatastoreType.CONFIGURATION, id, broker);
if (ifInstance.isPresent()) {
IfL2vlan vlanIface = ifInstance.get().getAugmentation(IfL2vlan.class);
return vlanIface.getVlanId() == null ? 0 : vlanIface.getVlanId().getValue().shortValue();
}
return -1;
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.IfL2vlan 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