+
+ @Override
+ public Future<RpcResult<MonitorProfileGetOutput>> monitorProfileGet(MonitorProfileGetInput input){
+ LOG.debug("Monitor Profile Get operation for input profile- {}", input.getProfile());
+ RpcResultBuilder<MonitorProfileGetOutput> rpcResultBuilder;
+ try{
+ final Long profileId = getExistingProfileId(input);
+
+ MonitorProfileGetOutputBuilder output = new MonitorProfileGetOutputBuilder().setProfileId(profileId);
+ rpcResultBuilder = RpcResultBuilder.success();
+ rpcResultBuilder.withResult(output.build());
+ }catch(Exception e){
+ LOG.error("Retrieval of monitor profile ID for input {} failed due to {}" , input, e);
+ rpcResultBuilder = RpcResultBuilder.failed();
+ }
+ return Futures.immediateFuture(rpcResultBuilder.build());
+ }
+
+ private Long getExistingProfileId(MonitorProfileGetInput input){
+ org.opendaylight.yang.gen.v1.urn.opendaylight.vpnservice.alivenessmonitor.rev150629.monitor.profile.get.input.Profile profile = input.getProfile();
+ final Long failureThreshold = profile.getFailureThreshold();
+ final Long monitorInterval = profile.getMonitorInterval();
+ final Long monitorWindow = profile.getMonitorWindow();
+ final EtherTypes ethType = profile.getProtocolType();
+ LOG.debug("getExistingProfileId for profile : {}", input.getProfile());
+ String idKey = getUniqueProfileKey(failureThreshold, monitorInterval, monitorWindow, ethType);
+ LOG.debug("Obtained existing profile ID for profile : {}", input.getProfile());
+ return (Long.valueOf(getUniqueId(idKey)));
+ }
+