+ 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;
+ }
+
+ @Override
+ public Long getPortForInterface(Interface intf) {
+ GetPortFromInterfaceInput input = new GetPortFromInterfaceInputBuilder().setIntfName(intf.getName()).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;
+ }
+
+ @Override
+ public BigInteger getDpnForInterface(String ifName) {
+ GetDpidFromInterfaceInput input = new GetDpidFromInterfaceInputBuilder().setIntfName(ifName).build();
+ Future<RpcResult<GetDpidFromInterfaceOutput>> output = interfaceManagerRpcService.getDpidFromInterface(input);
+ try {
+ RpcResult<GetDpidFromInterfaceOutput> dpn = output.get();
+ if(dpn.isSuccessful()){
+ return dpn.getResult().getDpid();
+ }
+ }catch(NullPointerException | InterruptedException | ExecutionException e){
+ LOG.warn("Exception when getting port for interface",e);
+ }
+ return null;