use of org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rpcs.rev160406.GetPortFromInterfaceInputBuilder in project genius by opendaylight.
the class InterfaceManagerConfigurationTest method checkVlanRpcs.
private void checkVlanRpcs() throws Exception {
// 1. Test dpn-id fetching from interface
GetDpidFromInterfaceInput dpidFromInterfaceInput = new GetDpidFromInterfaceInputBuilder().setIntfName(INTERFACE_NAME).build();
Future<RpcResult<GetDpidFromInterfaceOutput>> dpidFromInterfaceOutput = odlInterfaceRpcService.getDpidFromInterface(dpidFromInterfaceInput);
Assert.assertEquals(DpnFromInterfaceOutput.newDpnFromInterfaceOutput(), dpidFromInterfaceOutput.get().getResult());
// 3. Test egress actions fetching for interface
GetEgressActionsForInterfaceInput egressActionsForInterfaceInput = new GetEgressActionsForInterfaceInputBuilder().setIntfName(INTERFACE_NAME).build();
Future<RpcResult<GetEgressActionsForInterfaceOutput>> egressActionsForInterfaceOutput = odlInterfaceRpcService.getEgressActionsForInterface(egressActionsForInterfaceInput);
assertEqualBeans(EgressActionsForInterfaceOutput.newEgressActionsForInterfaceOutput(), egressActionsForInterfaceOutput.get().getResult());
// 4. Test egress instructions fetching for interface
GetEgressInstructionsForInterfaceInput egressInstructionsForInterfaceInput = new GetEgressInstructionsForInterfaceInputBuilder().setIntfName(INTERFACE_NAME).build();
Future<RpcResult<GetEgressInstructionsForInterfaceOutput>> egressInstructionsForInterfaceOutput = odlInterfaceRpcService.getEgressInstructionsForInterface(egressInstructionsForInterfaceInput);
assertEqualBeans(EgressInstructionsForInterfaceOutput.newEgressInstructionsForInterfaceOutput(), egressInstructionsForInterfaceOutput.get().getResult());
// 5. Test interface fetching from if-index
/* FIXME can be tested only once ResourceBatchingManager becomes testable
GetInterfaceFromIfIndexInput interfaceFromIfIndexInput = new GetInterfaceFromIfIndexInputBuilder()
.setIfIndex(1).build();
Future<RpcResult<GetInterfaceFromIfIndexOutput>> interfaceFromIfIndexOutput = odlInterfaceRpcService
.getInterfaceFromIfIndex(interfaceFromIfIndexInput);
assertEqualBeans(InterfaceFromIfIndexOutput.newInterfaceFromIfIndexOutput(),
interfaceFromIfIndexOutput.get().getResult());*/
// 6. Test interface type fetching from interface-name
GetInterfaceTypeInput interfaceTypeInput = new GetInterfaceTypeInputBuilder().setIntfName(INTERFACE_NAME).build();
Future<RpcResult<GetInterfaceTypeOutput>> interfaceTypeOutput = odlInterfaceRpcService.getInterfaceType(interfaceTypeInput);
assertEqualBeans(InterfaceTypeOutput.newInterfaceTypeOutput(), interfaceTypeOutput.get().getResult());
// 7. Test get nodeconnector-id from interface-name
GetNodeconnectorIdFromInterfaceInput nodeconnectorIdFromInterfaceInput = new GetNodeconnectorIdFromInterfaceInputBuilder().setIntfName(INTERFACE_NAME).build();
Future<RpcResult<GetNodeconnectorIdFromInterfaceOutput>> nodeconnectorIdFromInterfaceOutput = odlInterfaceRpcService.getNodeconnectorIdFromInterface(nodeconnectorIdFromInterfaceInput);
assertEqualBeans(NodeconnectorIdFromInterfaceOutput.newNodeconnectorIdFromInterfaceOutput(), nodeconnectorIdFromInterfaceOutput.get().getResult());
// 8. Test get port details from interface-name
GetPortFromInterfaceInput portFromInterfaceInput = new GetPortFromInterfaceInputBuilder().setIntfName(INTERFACE_NAME).build();
Future<RpcResult<GetPortFromInterfaceOutput>> portFromInterfaceOutput = odlInterfaceRpcService.getPortFromInterface(portFromInterfaceInput);
assertEqualBeans(PortFromInterfaceOutput.newPortFromInterfaceOutput(), portFromInterfaceOutput.get().getResult());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rpcs.rev160406.GetPortFromInterfaceInputBuilder in project genius by opendaylight.
the class InterfacemgrProvider method getPortForInterface.
@Override
public Long getPortForInterface(String ifName) {
GetPortFromInterfaceInput input = new GetPortFromInterfaceInputBuilder().setIntfName(ifName).build();
Future<RpcResult<GetPortFromInterfaceOutput>> output = interfaceManagerRpcService.getPortFromInterface(input);
try {
RpcResult<GetPortFromInterfaceOutput> port = output.get();
if (port.isSuccessful()) {
return port.getResult().getPortno();
}
} catch (NullPointerException | InterruptedException | ExecutionException e) {
LOG.warn("Exception when getting port for interface", e);
}
return null;
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rpcs.rev160406.GetPortFromInterfaceInputBuilder in project genius by opendaylight.
the class ArpUtilImpl method getPortFromInterface.
private GetPortFromInterfaceOutput getPortFromInterface(String interfaceName) throws InterruptedException, ExecutionException {
GetPortFromInterfaceInputBuilder getPortFromInterfaceInputBuilder = new GetPortFromInterfaceInputBuilder();
getPortFromInterfaceInputBuilder.setIntfName(interfaceName);
Future<RpcResult<GetPortFromInterfaceOutput>> portFromInterface = odlInterfaceRpcService.getPortFromInterface(getPortFromInterfaceInputBuilder.build());
GetPortFromInterfaceOutput result = portFromInterface.get().getResult();
LOG.trace("getPortFromInterface rpc result is {} ", result);
if (result != null) {
LOG.trace("getPortFromInterface rpc result is {} {} ", result.getDpid(), result.getPortno());
}
return result;
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rpcs.rev160406.GetPortFromInterfaceInputBuilder in project netvirt by opendaylight.
the class Ipv6NdUtilServiceImpl method getPortFromInterface.
private GetPortFromInterfaceOutput getPortFromInterface(String interfaceName) {
GetPortFromInterfaceInputBuilder getPortFromInterfaceInputBuilder = new GetPortFromInterfaceInputBuilder();
getPortFromInterfaceInputBuilder.setIntfName(interfaceName);
GetPortFromInterfaceOutput result = null;
Future<RpcResult<GetPortFromInterfaceOutput>> portFromInterface = odlInterfaceRpcService.getPortFromInterface(getPortFromInterfaceInputBuilder.build());
try {
result = portFromInterface.get().getResult();
LOG.trace("getPortFromInterface rpc result is {} ", result);
} catch (InterruptedException | ExecutionException e) {
LOG.error("Error while retrieving the interfaceName from tag using getInterfaceFromIfIndex RPC");
}
return result;
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rpcs.rev160406.GetPortFromInterfaceInputBuilder in project netvirt by opendaylight.
the class QosNeutronUtils method getPortNumberForInterface.
public String getPortNumberForInterface(String ifName) {
GetPortFromInterfaceInput portNumberInput = new GetPortFromInterfaceInputBuilder().setIntfName(ifName).build();
Future<RpcResult<GetPortFromInterfaceOutput>> portNumberOutput = odlInterfaceRpcService.getPortFromInterface(portNumberInput);
try {
RpcResult<GetPortFromInterfaceOutput> portResult = portNumberOutput.get();
if (portResult.isSuccessful()) {
return portResult.getResult().getPortno().toString();
}
} catch (NullPointerException | InterruptedException | ExecutionException e) {
LOG.warn("Exception when getting port for interface {}", e);
}
return null;
}
Aggregations