use of org.opendaylight.genius.interfacemanager.globals.InterfaceInfo in project genius by opendaylight.
the class ItmTunnelAggregationHelper method updateTunnelAggregationGroup.
private void updateTunnelAggregationGroup(InterfaceParentEntry parentEntry) {
String logicTunnelName = parentEntry.getParentInterface();
InternalTunnel logicInternalTunnel = ItmUtils.ITM_CACHE.getInternalTunnel(logicTunnelName);
if (logicInternalTunnel == null) {
LOG.debug("MULTIPLE_VxLAN_TUNNELS: {} not found in internal tunnels list", logicTunnelName);
return;
}
InterfaceInfo ifLogicTunnel = interfaceManager.getInterfaceInfoFromOperationalDataStore(logicTunnelName);
long groupId = ifLogicTunnel != null ? interfaceManager.getLogicalTunnelSelectGroupId(ifLogicTunnel.getInterfaceTag()) : INVALID_ID;
BigInteger srcDpnId = logicInternalTunnel.getSourceDPN();
List<Bucket> listBuckets = new ArrayList<>();
List<InterfaceChildEntry> interfaceChildEntries = parentEntry.getInterfaceChildEntry();
if (interfaceChildEntries == null || interfaceChildEntries.isEmpty()) {
LOG.debug("MULTIPLE_VxLAN_TUNNELS: empty child list in group {}", parentEntry.getParentInterface());
return;
}
for (InterfaceChildEntry interfaceChildEntry : interfaceChildEntries) {
String curChildName = interfaceChildEntry.getChildInterface();
org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.Interface childIface = ItmUtils.getInterface(curChildName, interfaceManager);
IfTunnel ifTunnel = childIface != null ? childIface.getAugmentation(IfTunnel.class) : null;
if (ifTunnel == null || !ifTunnel.getTunnelInterfaceType().isAssignableFrom(TunnelTypeVxlan.class)) {
LOG.debug("MULTIPLE_VxLAN_TUNNELS: not tunnel interface {} found in group {}", curChildName, logicTunnelName);
continue;
}
ParentRefs parentRefs = childIface.getAugmentation(ParentRefs.class);
if (parentRefs == null) {
LOG.debug("MULTIPLE_VxLAN_TUNNELS: parent refs not specified for interface {} in group {}", curChildName, logicTunnelName);
continue;
}
InterfaceInfo ifInfo = interfaceManager.getInterfaceInfoFromOperationalDataStore(curChildName);
if (ifInfo == null) {
LOG.debug("MULTIPLE_VxLAN_TUNNELS: interface state not found for {} in groupId {}", curChildName, groupId);
continue;
}
int bucketId = interfaceChildEntries.indexOf(interfaceChildEntry);
LOG.debug("MULTIPLE_VxLAN_TUNNELS: updateTunnelAggregationGroup - add bucketId {} to groupId {}", bucketId, groupId);
listBuckets.add(createBucket(curChildName, ifTunnel, bucketId, ifInfo.getPortNo()));
}
if (!listBuckets.isEmpty()) {
Group group = MDSALUtil.buildGroup(groupId, logicTunnelName, GroupTypes.GroupSelect, MDSALUtil.buildBucketLists(listBuckets));
mdsalManager.syncInstallGroup(srcDpnId, group);
}
}
use of org.opendaylight.genius.interfacemanager.globals.InterfaceInfo in project genius by opendaylight.
the class InterfacemgrProvider method getInterfaceInfoFromOperationalDataStore.
@Override
public InterfaceInfo getInterfaceInfoFromOperationalDataStore(String interfaceName, InterfaceInfo.InterfaceType interfaceType) {
InterfaceInfo interfaceInfo = new InterfaceInfo(interfaceName);
org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.Interface ifState = interfaceManagerCommonUtils.getInterfaceState(interfaceName);
if (ifState == null) {
LOG.debug("Interface {} is not present", interfaceName);
return null;
}
NodeConnectorId ncId = IfmUtil.getNodeConnectorIdFromInterface(ifState);
if (ncId != null) {
interfaceInfo.setDpId(IfmUtil.getDpnFromNodeConnectorId(ncId));
interfaceInfo.setPortNo(Integer.parseInt(IfmUtil.getPortNoFromNodeConnectorId(ncId)));
}
interfaceInfo.setAdminState(ifState.getAdminStatus() == AdminStatus.Up ? InterfaceAdminState.ENABLED : InterfaceAdminState.DISABLED);
interfaceInfo.setInterfaceName(interfaceName);
Integer lportTag = ifState.getIfIndex();
interfaceInfo.setInterfaceTag(lportTag);
interfaceInfo.setInterfaceType(interfaceType);
interfaceInfo.setGroupId(IfmUtil.getGroupId(lportTag, interfaceType));
interfaceInfo.setOpState(InterfaceInfo.InterfaceOpState.fromModel(ifState.getOperStatus()));
PhysAddress phyAddress = ifState.getPhysAddress();
if (phyAddress != null) {
interfaceInfo.setMacAddress(ifState.getPhysAddress().getValue());
}
return interfaceInfo;
}
use of org.opendaylight.genius.interfacemanager.globals.InterfaceInfo in project genius by opendaylight.
the class ShowVlan method doExecute.
@Override
protected Object doExecute() {
LOG.debug("Executing show VLAN command");
List<Interface> vlanList = interfaceManager.getVlanInterfaces();
if (!vlanList.isEmpty()) {
IfmCLIUtil.showVlanHeaderOutput(session);
}
for (Interface iface : vlanList) {
InterfaceInfo ifaceState = interfaceManager.getInterfaceInfoFromOperationalDSCache(iface.getName());
IfmCLIUtil.showVlanOutput(ifaceState, iface, session);
}
return null;
}
use of org.opendaylight.genius.interfacemanager.globals.InterfaceInfo in project genius by opendaylight.
the class ShowVxlan method doExecute.
@Override
protected Object doExecute() {
LOG.debug("Executing show Vxlan command");
List<Interface> vxlanList = interfaceManager.getVxlanInterfaces();
if (!vxlanList.isEmpty()) {
IfmCLIUtil.showVxlanHeaderOutput(session);
}
for (Interface iface : vxlanList) {
InterfaceInfo ifaceState = interfaceManager.getInterfaceInfoFromOperationalDSCache(iface.getName());
IfmCLIUtil.showVxlanOutput(iface, ifaceState, session);
}
return null;
}
use of org.opendaylight.genius.interfacemanager.globals.InterfaceInfo in project genius by opendaylight.
the class InterfaceHelper method buildVxlanTunnelInterfaceFromInfo.
public static Interface buildVxlanTunnelInterfaceFromInfo(TunnelInterfaceDetails tunnelInterfaceDetails) {
InterfaceInfo interfaceInfo = tunnelInterfaceDetails.getInterfaceInfo();
ParentRefs parentRefs = new ParentRefsBuilder().setDatapathNodeIdentifier(interfaceInfo.getDpId()).setParentInterface(interfaceInfo.getInterfaceName()).build();
IfTunnel tunnel = new IfTunnelBuilder().setTunnelDestination(new IpAddress(new Ipv4Address(tunnelInterfaceDetails.getDstIp()))).setTunnelGateway(new IpAddress(new Ipv4Address(DEFAULT_GW))).setTunnelSource(new IpAddress(new Ipv4Address(tunnelInterfaceDetails.getSrcIp()))).setTunnelInterfaceType(TunnelTypeVxlan.class).setInternal(!tunnelInterfaceDetails.isExternal()).setTunnelRemoteIpFlow(false).setTunnelOptions(Collections.emptyList()).build();
return new InterfaceBuilder().setKey(new InterfaceKey(interfaceInfo.getInterfaceName())).setName(interfaceInfo.getInterfaceName()).setDescription("Tunnel interface").setEnabled(true).setType(Tunnel.class).addAugmentation(ParentRefs.class, parentRefs).addAugmentation(IfTunnel.class, tunnel).build();
}
Aggregations