use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.InterfaceKey in project genius by opendaylight.
the class InterfaceManagerServiceImpl method getEndpointIpForDpn.
@Override
public ListenableFuture<GetEndpointIpForDpnOutput> getEndpointIpForDpn(GetEndpointIpForDpnInput input) {
BridgeEntryKey bridgeEntryKey = new BridgeEntryKey(input.getDpid());
InstanceIdentifier<BridgeEntry> bridgeEntryInstanceIdentifier = InterfaceMetaUtils.getBridgeEntryIdentifier(bridgeEntryKey);
BridgeEntry bridgeEntry = interfaceMetaUtils.getBridgeEntryFromConfigDS(bridgeEntryInstanceIdentifier);
// local ip of any of the bridge interface entry will be the dpn end
// point ip
BridgeInterfaceEntry bridgeInterfaceEntry = bridgeEntry.getBridgeInterfaceEntry().get(0);
InterfaceKey interfaceKey = new InterfaceKey(bridgeInterfaceEntry.getInterfaceName());
Interface interfaceInfo = interfaceManagerCommonUtils.getInterfaceFromConfigDS(interfaceKey);
IfTunnel tunnel = interfaceInfo.getAugmentation(IfTunnel.class);
return Futures.immediateFuture(new GetEndpointIpForDpnOutputBuilder().setLocalIps(Collections.singletonList(tunnel.getTunnelSource())).build());
}
use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.InterfaceKey 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());
}
use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.InterfaceKey in project genius by opendaylight.
the class InterfaceManagerTestUtil method updateTunnelMonitoringAttributes.
static void updateTunnelMonitoringAttributes(DataBroker dataBroker, String ifaceName) throws TransactionCommitFailedException {
InstanceIdentifier<Interface> tunnelInstanceIdentifier = IfmUtil.buildId(ifaceName);
InterfaceBuilder builder = new InterfaceBuilder().setKey(new InterfaceKey(ifaceName)).setName(ifaceName);
IfTunnel tunnel = new IfTunnelBuilder().setMonitorProtocol(TunnelMonitoringTypeBfd.class).setMonitorEnabled(true).build();
builder.addAugmentation(IfTunnel.class, tunnel);
WriteTransaction tx = dataBroker.newWriteOnlyTransaction();
tx.merge(CONFIGURATION, tunnelInstanceIdentifier, builder.build());
tx.submit().checkedGet();
}
use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.InterfaceKey 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.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.InterfaceKey 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