use of org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.global.base.Config in project genius by opendaylight.
the class InterfacemgrProvider method getChildInterfaces.
@Override
public List<Interface> getChildInterfaces(ReadTransaction tx, String parentInterface) throws ReadFailedException {
InterfaceParentEntry parentEntry = interfaceMetaUtils.getInterfaceParentEntryFromConfigDS(tx, parentInterface);
if (parentEntry == null) {
LOG.debug("No parent entry found for {}", parentInterface);
return Collections.emptyList();
}
List<InterfaceChildEntry> childEntries = parentEntry.getInterfaceChildEntry();
if (childEntries == null || childEntries.isEmpty()) {
LOG.debug("No child entries found for parent {}", parentInterface);
return Collections.emptyList();
}
List<Interface> childInterfaces = new ArrayList<>();
for (InterfaceChildEntry childEntry : childEntries) {
String interfaceName = childEntry.getChildInterface();
Interface iface = interfaceManagerCommonUtils.getInterfaceFromConfigDS(tx, interfaceName);
if (iface != null) {
childInterfaces.add(iface);
} else {
LOG.debug("Child interface {} not found in config DS for parent interface {}", interfaceName, parentInterface);
}
}
LOG.trace("Found child interfaces {} for parent {}", childInterfaces, parentInterface);
return childInterfaces;
}
use of org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.global.base.Config in project genius by opendaylight.
the class SouthboundUtils method addAllPortsToBridge.
/*
* Add all tunnels ports corresponding to the bridge to the topology config DS.
*/
public void addAllPortsToBridge(BridgeEntry bridgeEntry, InterfaceManagerCommonUtils interfaceManagerCommonUtils, InstanceIdentifier<OvsdbBridgeAugmentation> bridgeIid, OvsdbBridgeAugmentation bridgeNew) {
String bridgeName = bridgeNew.getBridgeName().getValue();
LOG.debug("adding all ports to bridge: {}", bridgeName);
List<BridgeInterfaceEntry> bridgeInterfaceEntries = bridgeEntry.getBridgeInterfaceEntry();
if (bridgeInterfaceEntries != null) {
for (BridgeInterfaceEntry bridgeInterfaceEntry : bridgeInterfaceEntries) {
String portName = bridgeInterfaceEntry.getInterfaceName();
InterfaceKey interfaceKey = new InterfaceKey(portName);
Interface iface = interfaceManagerCommonUtils.getInterfaceFromConfigDS(interfaceKey);
if (iface != null) {
IfTunnel ifTunnel = iface.getAugmentation(IfTunnel.class);
if (ifTunnel != null) {
if (!(interfacemgrProvider.isItmDirectTunnelsEnabled() && ifTunnel.isInternal())) {
addTunnelPortToBridge(ifTunnel, bridgeIid, iface, portName);
}
if (isOfTunnel(ifTunnel)) {
LOG.debug("Using OFTunnel. Only one tunnel port will be added");
return;
}
}
} else {
LOG.debug("Interface {} not found in config DS", portName);
}
}
}
}
use of org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.global.base.Config in project genius by opendaylight.
the class InterfaceManagerServiceImpl method getDpidFromInterface.
@Override
public ListenableFuture<GetDpidFromInterfaceOutput> getDpidFromInterface(GetDpidFromInterfaceInput input) {
String interfaceName = input.getIntfName();
BigInteger dpId;
InterfaceKey interfaceKey = new InterfaceKey(interfaceName);
Interface interfaceInfo = interfaceManagerCommonUtils.getInterfaceFromConfigDS(interfaceKey);
if (interfaceInfo == null) {
throw new IllegalArgumentException(getDpidFromInterfaceErrorMessage(interfaceName, "missing Interface in Config DataStore"));
}
if (Tunnel.class.equals(interfaceInfo.getType())) {
ParentRefs parentRefs = interfaceInfo.getAugmentation(ParentRefs.class);
dpId = parentRefs.getDatapathNodeIdentifier();
} else {
org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.Interface ifState = interfaceManagerCommonUtils.getInterfaceState(interfaceName);
if (ifState != null) {
String lowerLayerIf = ifState.getLowerLayerIf().get(0);
NodeConnectorId nodeConnectorId = new NodeConnectorId(lowerLayerIf);
dpId = IfmUtil.getDpnFromNodeConnectorId(nodeConnectorId);
} else {
throw new IllegalArgumentException(getDpidFromInterfaceErrorMessage(interfaceName, "missing Interface-state"));
}
}
return Futures.immediateFuture(new GetDpidFromInterfaceOutputBuilder().setDpid(dpId).build());
}
use of org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.global.base.Config in project genius by opendaylight.
the class InterfaceManagerServiceImpl method getTunnelType.
@Override
public ListenableFuture<GetTunnelTypeOutput> getTunnelType(GetTunnelTypeInput input) {
String interfaceName = input.getIntfName();
InterfaceKey interfaceKey = new InterfaceKey(interfaceName);
Interface interfaceInfo = interfaceManagerCommonUtils.getInterfaceFromConfigDS(interfaceKey);
if (interfaceInfo == null) {
throw new IllegalArgumentException(String.format("Retrieval of Tunnel Type for the key {%s} failed due to missing Interface in Config DataStore", interfaceName));
}
if (Tunnel.class.equals(interfaceInfo.getType())) {
IfTunnel tnl = interfaceInfo.getAugmentation(IfTunnel.class);
Class<? extends TunnelTypeBase> tunType = tnl.getTunnelInterfaceType();
return Futures.immediateFuture(new GetTunnelTypeOutputBuilder().setTunnelType(tunType).build());
} else {
throw new IllegalArgumentException("Retrieval of interface type failed for key: " + interfaceName);
}
}
use of org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.global.base.Config in project genius by opendaylight.
the class InterfaceManagerServiceImpl method getInterfaceType.
@Override
public ListenableFuture<GetInterfaceTypeOutput> getInterfaceType(GetInterfaceTypeInput input) {
String interfaceName = input.getIntfName();
InterfaceKey interfaceKey = new InterfaceKey(interfaceName);
Interface interfaceInfo = interfaceManagerCommonUtils.getInterfaceFromConfigDS(interfaceKey);
if (interfaceInfo == null) {
throw new IllegalStateException(String.format("getInterfaceType() Retrieval of Interface Type for " + "the key {%s} failed due to missing Interface in Config DataStore", interfaceName));
}
return Futures.immediateFuture(new GetInterfaceTypeOutputBuilder().setInterfaceType(interfaceInfo.getType()).build());
}
Aggregations