Turn on check-style and fixed style errors 71/20471/1
authorGao Kai <gaok12@mails.tsinghua.edu.cn>
Fri, 15 May 2015 02:27:52 +0000 (10:27 +0800)
committerY. Richard Yang <yry@cs.yale.edu>
Fri, 15 May 2015 02:39:37 +0000 (02:39 +0000)
Change-Id: I5edbc2b6d68cb221d7698fc9b009fd3afb1fc394
Signed-off-by: Gao Kai <gaok12@mails.tsinghua.edu.cn>
(cherry picked from commit c6e0a0fea2c4b5ff92e4e84e0a80ff2a51d903b4)

24 files changed:
alto-commons/src/main/java/org/opendaylight/alto/commons/types/converter/RFC2ModelCostMapMetaConverter.java
alto-commons/src/main/java/org/opendaylight/alto/commons/types/converter/RFC2ModelEndpointPropMapConverter.java
alto-commons/src/main/java/org/opendaylight/alto/commons/types/converter/RFC2ModelNetworkMapConverter.java
alto-commons/src/main/java/org/opendaylight/alto/commons/types/converter/YANGJSON2RFCAddressGroupConverter.java
alto-commons/src/main/java/org/opendaylight/alto/commons/types/converter/YANGJSON2RFCCostMapConverter.java
alto-commons/src/main/java/org/opendaylight/alto/commons/types/converter/YANGJSON2RFCNetworkMapConverter.java
alto-commons/src/main/java/org/opendaylight/alto/commons/types/model150404/ModelCostMapData.java
alto-commons/src/main/java/org/opendaylight/alto/commons/types/model150404/ModelCostMapMeta.java
alto-commons/src/main/java/org/opendaylight/alto/commons/types/model150404/ModelCostType.java
alto-commons/src/main/java/org/opendaylight/alto/commons/types/model150404/ModelDependentVtag.java
alto-commons/src/main/java/org/opendaylight/alto/commons/types/model150404/ModelEndpoint.java
alto-commons/src/main/java/org/opendaylight/alto/commons/types/model150404/ModelEndpointAddressGroup.java
alto-commons/src/main/java/org/opendaylight/alto/commons/types/model150404/ModelEndpointProperties.java
alto-commons/src/main/java/org/opendaylight/alto/commons/types/model150404/ModelEndpointPropertyMap.java
alto-commons/src/main/java/org/opendaylight/alto/commons/types/model150404/ModelEndpointPropertyMeta.java
alto-commons/src/main/java/org/opendaylight/alto/commons/types/model150404/ModelNetworkMap.java
alto-commons/src/main/java/org/opendaylight/alto/commons/types/model150404/ModelProperties.java
alto-commons/src/main/java/org/opendaylight/alto/commons/types/rfc7285/RFC7285EndpointPropertyMap.java
alto-manager/src/main/java/org/opendaylight/alto/manager/AltoDelete.java
alto-manager/src/main/java/org/opendaylight/alto/manager/AltoSet.java
alto-provider/src/main/java/org/opendaylight/alto/provider/AltoProvider.java
alto-provider/src/test/java/org/opendaylight/alto/provider/AltoProviderTest.java
alto-services/provider/simple-alto/src/main/java/org/opendaylight/alto/services/provider/simple/SimpleAltoService.java
pom.xml

index 716c182c459814a88034de276ec3fdf27285968f..0eda12f72eb20fbf871f9cd46658ac4f2fe80d73 100644 (file)
@@ -5,7 +5,7 @@ import org.opendaylight.alto.commons.types.model150404.ModelCostMapMeta;
 import org.opendaylight.alto.commons.types.model150404.ModelDependentVtag;
 import org.opendaylight.alto.commons.types.rfc7285.RFC7285CostMap;
 
-public class RFC2ModelCostMapMetaConverter 
+public class RFC2ModelCostMapMetaConverter
     extends Converter<RFC7285CostMap.Meta, ModelCostMapMeta>{
 
   public RFC2ModelCostMapMetaConverter() {
@@ -14,20 +14,20 @@ public class RFC2ModelCostMapMetaConverter
   public RFC2ModelCostMapMetaConverter(RFC7285CostMap.Meta _in) {
       super(_in);
   }
-  
+
   @Override
   protected Object _convert() {
     ModelCostMapMeta modelMeta = new ModelCostMapMeta();
-    
+
     ModelDependentVtag dvtag = new ModelDependentVtag();
     dvtag.rid = in().netmap_tags.get(0).rid;
     dvtag.vTag = in().netmap_tags.get(0).tag;
     modelMeta.dependentVtags.add(dvtag);
-    
+
     modelMeta.costType.costMetric = in().costType.metric;
     modelMeta.costType.costMode = in().costType.mode;
     modelMeta.costType.description = in().costType.description;
-    
+
     return modelMeta;
   }
 
index 5b81cadbffa56d14cf066a1633bb5b790445b581..f4db59149879f769a01889554aa72c944e175a49 100644 (file)
@@ -15,9 +15,9 @@ import org.opendaylight.alto.commons.types.model150404.ModelEndpointPropertyMeta
 import org.opendaylight.alto.commons.types.model150404.ModelProperties;
 import org.opendaylight.alto.commons.types.rfc7285.RFC7285EndpointPropertyMap;
 
-public class RFC2ModelEndpointPropMapConverter 
+public class RFC2ModelEndpointPropMapConverter
   extends Converter<RFC7285EndpointPropertyMap, ModelEndpointPropertyMap> {
-  
+
   @Override
   protected Object _convert() {
     ModelEndpointPropertyMap out = new ModelEndpointPropertyMap();
@@ -28,25 +28,25 @@ public class RFC2ModelEndpointPropMapConverter
     }
     return out;
   }
-  
+
   protected static String readFromFile(String path) throws IOException {
     return new String(Files.readAllBytes(Paths.get(path)),
         StandardCharsets.UTF_8);
   }
-  
+
   private ModelEndpointPropertyMeta convertMeta(RFC7285EndpointPropertyMap.Meta meta) {
     ModelEndpointPropertyMeta endpointPropertyMeta = new ModelEndpointPropertyMeta();
-    
+
     endpointPropertyMeta.dependentVtags = new LinkedList<ModelDependentVtag>();
     ModelDependentVtag dependentVtag = new ModelDependentVtag();
     dependentVtag.rid = meta.netmap_tags.get(0).rid;
     dependentVtag.vTag = meta.netmap_tags.get(0).tag;
-    
+
     endpointPropertyMeta.dependentVtags.add(dependentVtag);
     return endpointPropertyMeta;
   }
-  
-  private ModelEndpointProperties 
+
+  private ModelEndpointProperties
     convertEndpointProperty(String endpoint, Map<String, String> property) {
       ModelEndpointProperties endpointProperty = new ModelEndpointProperties();
       endpointProperty.endpoint = endpoint;
@@ -56,7 +56,7 @@ public class RFC2ModelEndpointPropMapConverter
       }
       return endpointProperty;
   }
-  
+
   private ModelProperties convertProperty(String propertyType, String propertyValue) {
     ModelProperties property = new ModelProperties();
     property.propertyType = propertyType;
index db4eccf83279cef136ee1f389fc1e8b1865db928..dfe9bef28c3febf1a6d27e580a622b6514a1218d 100644 (file)
@@ -15,7 +15,7 @@ public class RFC2ModelNetworkMapConverter
     public RFC2ModelNetworkMapConverter(RFC7285NetworkMap _in) {
         super(_in);
     }
-    
+
     @Override
     public Object _convert() {
         ModelNetworkMap out = new ModelNetworkMap();
index 1cec730822944c01ae96419b70de9ba870df5cc4..5e42549cbb19f55424244d3d27a8fc925aa45e9f 100644 (file)
@@ -2,11 +2,8 @@ package org.opendaylight.alto.commons.types.converter;
 
 import org.opendaylight.alto.commons.helper.Converter;
 
-import org.opendaylight.alto.commons.types.rfc7285.RFC7285VersionTag;
 import org.opendaylight.alto.commons.types.rfc7285.RFC7285Endpoint;
 
-import com.fasterxml.jackson.databind.ObjectMapper;
-import com.fasterxml.jackson.databind.node.ObjectNode;
 import com.fasterxml.jackson.databind.JsonNode;
 
 public class YANGJSON2RFCAddressGroupConverter extends Converter<JsonNode, RFC7285Endpoint.AddressGroup> {
index fb96dcac817a9bd0694a8437210bf889d5b9b0b4..6f477dd78631909a73ca0e62d501ed62040f950c 100644 (file)
@@ -4,15 +4,11 @@ import org.opendaylight.alto.commons.helper.Converter;
 
 import org.opendaylight.alto.commons.types.rfc7285.RFC7285CostMap;
 import org.opendaylight.alto.commons.types.rfc7285.RFC7285VersionTag;
-import org.opendaylight.alto.commons.types.rfc7285.RFC7285Endpoint;
 import org.opendaylight.alto.commons.types.rfc7285.RFC7285CostType;
 
-import java.util.Iterator;
 import java.util.Map;
 import java.util.LinkedHashMap;
 
-import com.fasterxml.jackson.databind.ObjectMapper;
-import com.fasterxml.jackson.databind.node.ObjectNode;
 import com.fasterxml.jackson.databind.JsonNode;
 
 public class YANGJSON2RFCCostMapConverter extends Converter<JsonNode, RFC7285CostMap> {
index fb7a89504775baaf1e1f0b904b5027b93af5b502..4b36788d6fc2a5eb400689c686693d00cc7ef860 100644 (file)
@@ -6,8 +6,6 @@ import org.opendaylight.alto.commons.types.rfc7285.RFC7285NetworkMap;
 import org.opendaylight.alto.commons.types.rfc7285.RFC7285VersionTag;
 import org.opendaylight.alto.commons.types.rfc7285.RFC7285Endpoint;
 
-import com.fasterxml.jackson.databind.ObjectMapper;
-import com.fasterxml.jackson.databind.node.ObjectNode;
 import com.fasterxml.jackson.databind.JsonNode;
 
 public class YANGJSON2RFCNetworkMapConverter extends Converter<JsonNode, RFC7285NetworkMap> {
index 74fd088ca853231c6647c8890c12ea08a199ae9f..27af6a43e75029317ee5b23f158d3ef5ffdfaec9 100644 (file)
@@ -17,10 +17,10 @@ public class ModelCostMapData implements Map {
 
   @JsonProperty("alto-service:src")
   public String src = null;
-  
+
   @JsonProperty("alto-service:dst-costs")
   public List<ModelDstCosts> dstCosts = new LinkedList<ModelDstCosts>();
-  
+
   @JsonIgnore
   @Override
   public Class<? extends DataContainer> getImplementedInterface() {
@@ -44,7 +44,7 @@ public class ModelCostMapData implements Map {
   public List<DstCosts> getDstCosts() {
     return new LinkedList<DstCosts>(dstCosts);
   }
-  
+
   @JsonIgnore
   @Override
   public MapKey getKey() {
index 7f142a8f22a0034a594af8d720a0dc1fefbd32b5..c7afe3f49904d7da2f12f2b18679841a6d6a099c 100644 (file)
@@ -16,10 +16,10 @@ public class ModelCostMapMeta implements Meta  {
 
   @JsonProperty("alto-service:dependent-vtags")
   public List<ModelDependentVtag> dependentVtags = new LinkedList<ModelDependentVtag>();
-  
+
   @JsonProperty("alto-service:cost-type")
   public ModelCostType costType = new ModelCostType();
-  
+
   @JsonIgnore
   @Override
   public Class<? extends DataContainer> getImplementedInterface() {
index 1a3af3685c42f99d1ae0f7f67f7b46e1de75af63..ac37f53dfcfd1b68de7f9e24f38034a56e22eb18 100644 (file)
@@ -14,19 +14,19 @@ public class ModelCostType implements CostType {
 
   @JsonIgnore
   public static final String NUMERICAL = "Numerical";
-  
+
   @JsonIgnore
   public static final String ORDINAL = "Ordinal";
-  
+
   @JsonProperty("alto-service:cost-mode")
   public String costMode = null;
-  
+
   @JsonProperty("alto-service:cost-metric")
   public String costMetric = null;
-  
+
   @JsonProperty("alto-service:description")
   public String description = null;
-  
+
   @JsonIgnore
   @Override
   public Class<? extends DataContainer> getImplementedInterface() {
@@ -48,7 +48,7 @@ public class ModelCostType implements CostType {
     case ORDINAL:
       return CostMode.Ordinal;
     default:
-      throw new RuntimeException("Non-Supported cost mode."); 
+      throw new RuntimeException("Non-Supported cost mode.");
     }
   }
 
index 32b0803b64756474a2ea8c66e0677c0e75fdcf7d..766b9b693001aaf72dcae21bf915da1cee524740 100644 (file)
@@ -14,10 +14,10 @@ public class ModelDependentVtag implements DependentVtags {
 
   @JsonProperty("alto-service:resource-id")
   public String rid = "";
-  
+
   @JsonProperty("alto-service:tag")
   public String vTag = "";
-  
+
   @JsonIgnore
   @Override
   public Class<? extends DataContainer> getImplementedInterface() {
index 8513ca296e885444b96b776ffd6b2d47bc57573c..f17cb66e64c073a0d9c90a948b5f0cec17b6e051 100644 (file)
@@ -19,7 +19,7 @@ public class ModelEndpoint implements Map {
 
     @JsonProperty("alto-service:endpoint-address-group")
     public List<ModelEndpointAddressGroup> addressGroup = new LinkedList<ModelEndpointAddressGroup>();
-    
+
     @JsonIgnore
     @Override
     public Class<Map> getImplementedInterface() {
index 375cf49641446bcdae0645e8622a33935ab4b755..0ced11fa78b7107ba9bf6ac27eb51836f795c1ca 100644 (file)
@@ -17,7 +17,7 @@ public class ModelEndpointAddressGroup implements EndpointAddressGroup {
 
     @JsonIgnore
     public static final String IPV4 = "ipv4";
-    
+
     @JsonIgnore
     public static final String IPV6 = "ipv6";
 
index ff47dc40f6fa882df2ba8da7f340ad06156c9a8b..c87a79041dd2db179e587ecddabb25b67b8f0c5c 100644 (file)
@@ -17,7 +17,7 @@ public class ModelEndpointProperties implements EndpointProperties {
 
   @JsonProperty("alto-service:endpoint")
   public String endpoint = null;
-  
+
   @JsonProperty("alto-service:properties")
   public List<ModelProperties> properties = new LinkedList<ModelProperties>();
 
@@ -36,8 +36,8 @@ public class ModelEndpointProperties implements EndpointProperties {
 
   @JsonIgnore
   @Override
-  public TypedEndpointAddress getEndpoint() {    
-    return new TypedEndpointAddress(endpoint.toCharArray()); 
+  public TypedEndpointAddress getEndpoint() {
+    return new TypedEndpointAddress(endpoint.toCharArray());
   }
 
   @JsonIgnore
index dfe3f41ad590277b38fbb7f367b1ef04910f4672..3d479394b8e4a243dc545da7863beeebd5806f9d 100644 (file)
@@ -15,10 +15,10 @@ public class ModelEndpointPropertyMap implements EndpointPropertyMap {
 
   @JsonProperty("alto-service:meta")
   public ModelEndpointPropertyMeta endpointPropertyMeta = new ModelEndpointPropertyMeta();
-  
+
   @JsonProperty("alto-service:endpoint-properties")
   public List<ModelEndpointProperties> properties = new LinkedList<ModelEndpointProperties>();
-  
+
   @JsonIgnore
   @Override
   public Class<? extends DataContainer> getImplementedInterface() {
index ee4a67e82b924426281aba318c1f9959d91ff68c..780f981fb9c62de72fd0f68c3b52c6117256f7d1 100644 (file)
@@ -14,7 +14,7 @@ public class ModelEndpointPropertyMeta implements Meta {
 
   @JsonProperty("alto-service:dependent-vtags")
   public List<ModelDependentVtag> dependentVtags = new LinkedList<ModelDependentVtag>();
-  
+
   @Override
   public Class<? extends DataContainer> getImplementedInterface() {
     return Meta.class;
index 34cfcf8df39fbed819b6e6f3d21cf8de9f2891f7..7d844e59bca84e3eeb3d4c1a2b44953c40fb7e65 100644 (file)
@@ -12,7 +12,7 @@ import com.fasterxml.jackson.annotation.JsonProperty;
 import com.fasterxml.jackson.annotation.JsonIgnore;
 
 public class ModelNetworkMap implements NetworkMap {
-    
+
     @JsonProperty("alto-service:resource-id")
     public String rid = null;
 
index 001a825ad81d50dc52a71bf17f8fb51221be2e54..f8a634a4db056e9fdb341339fcc940e96a58b508 100644 (file)
@@ -14,10 +14,10 @@ public class ModelProperties implements Properties {
 
   @JsonProperty("alto-service:property-type")
   public String propertyType = null;
-  
+
   @JsonProperty("alto-service:property")
   public String propertyValue = null;
-  
+
   @JsonIgnore
   @Override
   public Class<? extends DataContainer> getImplementedInterface() {
index 7a13b8328a66c5c9b73fab73c3a4a4a29afc7900..4adda919cd51a10e93f89d6ad8d816b39586eff1 100644 (file)
@@ -7,16 +7,16 @@ import java.util.Map;
 import com.fasterxml.jackson.annotation.JsonProperty;
 
 public class RFC7285EndpointPropertyMap {
-  
+
   public static class Meta extends Extensible {
     @JsonProperty("dependent-vtags")
     public List<RFC7285VersionTag> netmap_tags;
   }
-  
+
   @JsonProperty("meta")
   public Meta meta;
-  
+
   @JsonProperty("endpoint-properties")
   public Map<String, Map<String, String>> map
-    = new LinkedHashMap<String, Map<String, String>>(); 
+    = new LinkedHashMap<String, Map<String, String>>();
 }
index 22829a1ceb047888e3e0886dfcc47544a4ce535a..ac2b69e245787142187c2946da8e7ae1bdc23df7 100644 (file)
@@ -13,14 +13,14 @@ public class AltoDelete extends AltoManager {
 
   @Argument(index = 0, name = "resource-type", description = "Resource Type", required = true, multiValued = false)
   String resourceType = null;
-  
+
   @Argument(index = 1, name = "resource-id", description = "Resource Id", required = false, multiValued = false)
   String resourceId = null;
-  
+
   public AltoDelete() {
     super();
   }
-  
+
   @Override
   protected Object doExecute() throws Exception {
     checkResourceID();
@@ -35,31 +35,31 @@ public class AltoDelete extends AltoManager {
     }
     return null;
   }
-  
+
   private void checkResourceID() throws IOException {
     if (networkMapType().equals(resourceType) && isDefaultNetworkMap(resourceId)) {
       throw new RuntimeException("Cannot destroy default network map.");
     }
-    
+
     if (resourceId == null && !endpointPropertyMapType().equals(resourceType)) {
       throw new RuntimeException("Please specify resource id for " + resourceType + ".");
     }
-    
+
     if (resourceId != null && endpointPropertyMapType().equals(resourceType)) {
       throw new RuntimeException("Please do not specify resource id for " + resourceType + ".");
     }
   }
-  
+
   private boolean deleteEndpointPropertyMap() throws IOException {
     log.info("Deleting endpoint property map " + this.resourceId);
     return httpDelete(AltoManagerConstants.RESOURCES_URL + AltoManagerConstants.ENDPOINT_PROPERTY_MAP_NODE);
   }
-  
+
   private boolean deleteCostMap() throws IOException {
     log.info("Deleting endpoint property map " + this.resourceId);
     return httpDelete(AltoManagerConstants.COST_MAP_URL + resourceId);
   }
-  
+
   private boolean deleteNetworkMap() throws IOException {
     log.info("Deleting endpoint property map " + this.resourceId);
     return httpDelete(AltoManagerConstants.NETWORK_MAP_URL + resourceId);
index c33d6985e57e487dce156bdc42a1803e3ec60574..5974a8fae4c10f4f32aaac4f2c412befdeeb297a 100644 (file)
@@ -11,17 +11,17 @@ import org.slf4j.LoggerFactory;
 @Command(scope = "alto", name = "set", description = "Set property")
 public class AltoSet extends AltoManager {
   private static final Logger log = LoggerFactory.getLogger(AltoSet.class);
-  
+
   @Argument(index = 0, name = "property-name", description = "Property Name", required = true, multiValued = false)
   String property = null;
-  
+
   @Argument(index = 1, name = "property-value", description = "Property Value", required = true, multiValued = false)
   String value = null;
 
   public AltoSet() {
     super();
   }
-  
+
   @Override
   protected Object doExecute() throws Exception {
     if (AltoManagerConstants.DEFAULT_NETWORK_MAP_PROPERTY.equals(property)) {
@@ -34,19 +34,19 @@ public class AltoSet extends AltoManager {
     }
     return null;
   }
-  
+
   private boolean ifNetworkMapExist(String resourceId) throws IOException {
     HttpResponse response = httpGet(AltoManagerConstants.NETWORK_MAP_URL + resourceId);
     logResponse(response);
     int statusCode = response.getStatusLine().getStatusCode();
     return (statusCode == 200);
   }
-  
+
   private void setDefaultNetworkMap() throws IOException {
     log.info("Setting default network map");
     httpPut(AltoManagerConstants.IRD_DEFAULT_NETWORK_MAP_URL, queryData(value));
   }
-  
+
   private String queryData(String resourceId) {
     return "{\"alto-service:default-alto-network-map\":{\"alto-service:resource-id\":\"" + resourceId + "\"}}";
   }
index 284cbbaf8034b0f4e0862cb3db0e8b5cd09d1172..0eca6402712e78b0bc4f0b35af5f98e02e82bebf 100644 (file)
@@ -82,7 +82,7 @@ public class AltoProvider implements
     private static final Logger log = LoggerFactory.getLogger(AltoProvider.class);
 
     private ListenerRegistration<DataChangeListener> hostNodeListerRegistration;
-    
+
     private ListenerRegistration<DataChangeListener> linkListerRegistration;
 
     private ListenerRegistration<DataChangeListener> topologyListerRegistration;
@@ -100,7 +100,7 @@ public class AltoProvider implements
     public AltoProvider() {
         this.networkGraph = new SparseMultigraph<>();
         this.shortestPath = new DijkstraShortestPath(this.networkGraph);
-       this.ipSwitchIdMap = new HashMap<String, String>();
+        this.ipSwitchIdMap = new HashMap<String, String>();
         this.linkAdded = new HashSet<>();
         this.networkGraphFlag = new AtomicBoolean(false);
         this.executor = Executors.newFixedThreadPool(1);
@@ -112,227 +112,227 @@ public class AltoProvider implements
     }
 
     public void registerAsDataChangeListener() {
-               InstanceIdentifier<HostNode> hostNodes = InstanceIdentifier
-                               .builder(NetworkTopology.class)//
-                               .child(Topology.class,
-                                               new TopologyKey(new TopologyId("flow:1")))//
-                               .child(Node.class).augmentation(HostNode.class).build();
-               this.hostNodeListerRegistration = dataProvider
-                               .registerDataChangeListener(LogicalDatastoreType.OPERATIONAL,
-                                               hostNodes, this, DataChangeScope.BASE);
-
-               InstanceIdentifier<Link> links = InstanceIdentifier
-                               .builder(NetworkTopology.class)//
-                               .child(Topology.class,
-                                               new TopologyKey(new TopologyId("flow:1")))//
-                               .child(Link.class).build();
-               this.linkListerRegistration = dataProvider.registerDataChangeListener(
-                               LogicalDatastoreType.OPERATIONAL, links, this,
-                               DataChangeScope.BASE);
-
-               InstanceIdentifier<Topology> topology = InstanceIdentifier
-                               .builder(NetworkTopology.class)//
-                               .child(Topology.class,
-                                               new TopologyKey(new TopologyId("flow:1"))).build();
+        InstanceIdentifier<HostNode> hostNodes = InstanceIdentifier
+                .builder(NetworkTopology.class)//
+                .child(Topology.class,
+                        new TopologyKey(new TopologyId("flow:1")))//
+                .child(Node.class).augmentation(HostNode.class).build();
+        this.hostNodeListerRegistration = dataProvider
+                .registerDataChangeListener(LogicalDatastoreType.OPERATIONAL,
+                        hostNodes, this, DataChangeScope.BASE);
+
+        InstanceIdentifier<Link> links = InstanceIdentifier
+                .builder(NetworkTopology.class)//
+                .child(Topology.class,
+                        new TopologyKey(new TopologyId("flow:1")))//
+                .child(Link.class).build();
+        this.linkListerRegistration = dataProvider.registerDataChangeListener(
+                LogicalDatastoreType.OPERATIONAL, links, this,
+                DataChangeScope.BASE);
+
+        InstanceIdentifier<Topology> topology = InstanceIdentifier
+                .builder(NetworkTopology.class)//
+                .child(Topology.class,
+                        new TopologyKey(new TopologyId("flow:1"))).build();
                 this.topologyListerRegistration = dataProvider.registerDataChangeListener(
-                               LogicalDatastoreType.OPERATIONAL, topology, this,
-                               DataChangeScope.BASE);
-
-               ReadOnlyTransaction newReadOnlyTransaction = dataProvider
-                               .newReadOnlyTransaction();
-
-               ListenableFuture<Optional<Topology>> dataFuture = newReadOnlyTransaction
-                               .read(LogicalDatastoreType.OPERATIONAL, topology);
-               try {
-                       Topology get = dataFuture.get().get();
-               } catch (InterruptedException | ExecutionException ex) {
-                       java.util.logging.Logger.getLogger(AltoProvider.class.getName())
-                                       .log(Level.SEVERE, null, ex);
-               }
-               Futures.addCallback(dataFuture,
-                               new FutureCallback<Optional<Topology>>() {
-                                       @Override
-                                       public void onSuccess(final Optional<Topology> result) {
-                                               if (result.isPresent()) {
-                                                       log.trace("Processing NEW NODE? " + result.get());
-                                                       processTopology(result.get());
-                                               }
-                                       }
-
-                                       @Override
-                                       public void onFailure(Throwable arg0) {
-                                       }
-                               });
-       }
-    
+                LogicalDatastoreType.OPERATIONAL, topology, this,
+                DataChangeScope.BASE);
+
+        ReadOnlyTransaction newReadOnlyTransaction = dataProvider
+                .newReadOnlyTransaction();
+
+        ListenableFuture<Optional<Topology>> dataFuture = newReadOnlyTransaction
+                .read(LogicalDatastoreType.OPERATIONAL, topology);
+        try {
+            Topology get = dataFuture.get().get();
+        } catch (InterruptedException | ExecutionException ex) {
+            java.util.logging.Logger.getLogger(AltoProvider.class.getName())
+                    .log(Level.SEVERE, null, ex);
+        }
+        Futures.addCallback(dataFuture,
+                new FutureCallback<Optional<Topology>>() {
+                    @Override
+                    public void onSuccess(final Optional<Topology> result) {
+                        if (result.isPresent()) {
+                            log.trace("Processing NEW NODE? " + result.get());
+                            processTopology(result.get());
+                        }
+                    }
+
+                    @Override
+                    public void onFailure(Throwable arg0) {
+                    }
+                });
+    }
+
     public synchronized void addLinks(List<Link> links) {
-               if (links == null || links.isEmpty()) {
-                       log.info("In addLinks: No link added as links is null or empty.");
-                       return;
-               }
+        if (links == null || links.isEmpty()) {
+            log.info("In addLinks: No link added as links is null or empty.");
+            return;
+        }
 
-               if (this.networkGraph == null) {
-                       this.networkGraph = new SparseMultigraph<>();
+        if (this.networkGraph == null) {
+            this.networkGraph = new SparseMultigraph<>();
                         networkGraphFlag.set(true);
-               }
-
-               for (Link link : links) {
-                       if (linkAlreadyAdded(link)) {
-                               continue;
-                       }
-                       NodeId sourceNodeId = link.getSource().getSourceNode();
-                       NodeId destinationNodeId = link.getDestination().getDestNode();
-                       this.networkGraph.addVertex(sourceNodeId);
-                       this.networkGraph.addVertex(destinationNodeId);
-                       this.networkGraph.addEdge(link, sourceNodeId, destinationNodeId,
-                                       EdgeType.UNDIRECTED);
+        }
+
+        for (Link link : links) {
+            if (linkAlreadyAdded(link)) {
+                continue;
+            }
+            NodeId sourceNodeId = link.getSource().getSourceNode();
+            NodeId destinationNodeId = link.getDestination().getDestNode();
+            this.networkGraph.addVertex(sourceNodeId);
+            this.networkGraph.addVertex(destinationNodeId);
+            this.networkGraph.addEdge(link, sourceNodeId, destinationNodeId,
+                    EdgeType.UNDIRECTED);
                         networkGraphFlag.set(true);
-               }
-
-       }
-
-       private boolean linkAlreadyAdded(Link link) {
-               String linkAddedKey = null;
-               if (link.getDestination().getDestTp().hashCode() > link.getSource()
-                               .getSourceTp().hashCode()) {
-                       linkAddedKey = link.getSource().getSourceTp().getValue()
-                                       + link.getDestination().getDestTp().getValue();
-               } else {
-                       linkAddedKey = link.getDestination().getDestTp().getValue()
-                                       + link.getSource().getSourceTp().getValue();
-               }
-               if (linkAdded.contains(linkAddedKey)) {
-                       return true;
-               } else {
-                       linkAdded.add(linkAddedKey);
-                       return false;
-               }
-       }
-
-       public void processTopology(Topology topology) {
-               List<Node> nodeList = null;
+        }
+
+    }
+
+    private boolean linkAlreadyAdded(Link link) {
+        String linkAddedKey = null;
+        if (link.getDestination().getDestTp().hashCode() > link.getSource()
+                .getSourceTp().hashCode()) {
+            linkAddedKey = link.getSource().getSourceTp().getValue()
+                    + link.getDestination().getDestTp().getValue();
+        } else {
+            linkAddedKey = link.getDestination().getDestTp().getValue()
+                    + link.getSource().getSourceTp().getValue();
+        }
+        if (linkAdded.contains(linkAddedKey)) {
+            return true;
+        } else {
+            linkAdded.add(linkAddedKey);
+            return false;
+        }
+    }
+
+    public void processTopology(Topology topology) {
+        List<Node> nodeList = null;
                 if ((nodeList = topology.getNode()) != null) {
-                   for (int i = 0; i < nodeList.size(); ++i) {
-                       Node node = nodeList.get(i);
-                       HostNode hostNode = node.getAugmentation(HostNode.class);
-                       log.info("process node "+i+hostNode);
-                       processNode(hostNode);
-                   }
-                   List<Link> linkList = topology.getLink();
-                   addLinks(linkList);
+            for (int i = 0; i < nodeList.size(); ++i) {
+            Node node = nodeList.get(i);
+            HostNode hostNode = node.getAugmentation(HostNode.class);
+            log.info("process node "+i+hostNode);
+            processNode(hostNode);
+            }
+            List<Link> linkList = topology.getLink();
+            addLinks(linkList);
                 }
-       }
+    }
 
-       private void deleteHostNode(HostNode hostNode) {
-                   List<AttachmentPoints> attachmentPoints = hostNode
-                                   .getAttachmentPoints();
+    private void deleteHostNode(HostNode hostNode) {
+            List<AttachmentPoints> attachmentPoints = hostNode
+                        .getAttachmentPoints();
 
-                   TpId tpId = attachmentPoints.get(0).getTpId();
-                   String tpIdString = tpId.getValue();
+            TpId tpId = attachmentPoints.get(0).getTpId();
+            String tpIdString = tpId.getValue();
 
-                   String ipv4String = hostNode.getAddresses().get(0).getIp()
-                                   .getIpv4Address().getValue();
+            String ipv4String = hostNode.getAddresses().get(0).getIp()
+                    .getIpv4Address().getValue();
 
-                   this.ipSwitchIdMap.remove(ipv4String);
-       }
+            this.ipSwitchIdMap.remove(ipv4String);
+    }
 
-       private void processNode(HostNode hostNode) {
+    private void processNode(HostNode hostNode) {
                 if (this.networkGraph==null) {
-                      this.networkGraph = new SparseMultigraph<>(); 
+                      this.networkGraph = new SparseMultigraph<>();
                 }
-               if(hostNode==null)return;
-               List<AttachmentPoints> attachmentPoints = hostNode
-                               .getAttachmentPoints();
+        if(hostNode==null)return;
+        List<AttachmentPoints> attachmentPoints = hostNode
+                .getAttachmentPoints();
+
+        TpId tpId = attachmentPoints.get(0).getTpId();
+        String tpIdString = tpId.getValue();
 
-               TpId tpId = attachmentPoints.get(0).getTpId();
-               String tpIdString = tpId.getValue();
+        String ipv4String = hostNode.getAddresses().get(0).getIp()
+                .getIpv4Address().getValue();
 
-               String ipv4String = hostNode.getAddresses().get(0).getIp()
-                               .getIpv4Address().getValue();
+        this.ipSwitchIdMap.put(ipv4String, tpIdString);
+    }
 
-               this.ipSwitchIdMap.put(ipv4String, tpIdString);
-       }
-       
 
     @Override
     public void onDataChanged(
             final AsyncDataChangeEvent<InstanceIdentifier<?>, DataObject> change) {
                 log.info("in Data Changed");
-               if (change == null) {
-                       log.info("In onDataChanged: No processing done as change even is null.");
-                       return;
-               }
-               Map<InstanceIdentifier<?>, DataObject> updatedData = change
-                               .getUpdatedData();
-               Map<InstanceIdentifier<?>, DataObject> createdData = change
-                               .getCreatedData();
-               Map<InstanceIdentifier<?>, DataObject> originalData = change
-                               .getOriginalData();
-               Set<InstanceIdentifier<?>> deletedData = change.getRemovedPaths();
-
-               for (InstanceIdentifier<?> iid : deletedData) {
+        if (change == null) {
+            log.info("In onDataChanged: No processing done as change even is null.");
+            return;
+        }
+        Map<InstanceIdentifier<?>, DataObject> updatedData = change
+                .getUpdatedData();
+        Map<InstanceIdentifier<?>, DataObject> createdData = change
+                .getCreatedData();
+        Map<InstanceIdentifier<?>, DataObject> originalData = change
+                .getOriginalData();
+        Set<InstanceIdentifier<?>> deletedData = change.getRemovedPaths();
+
+        for (InstanceIdentifier<?> iid : deletedData) {
                         log.info("delete Data");
-                       if (iid.getTargetType().equals(HostNode.class)) {
+            if (iid.getTargetType().equals(HostNode.class)) {
                                 log.info("delete hostnode");
-                               HostNode node = ((HostNode) originalData.get(iid));
-                               deleteHostNode(node);
-                       } else if (iid.getTargetType().equals(Link.class)) {
+                HostNode node = ((HostNode) originalData.get(iid));
+                deleteHostNode(node);
+            } else if (iid.getTargetType().equals(Link.class)) {
                                 log.info("delete edge");
-                               String linkAddedKey = null;
+                        String linkAddedKey = null;
                                 Link link = (Link) originalData.get(iid);
-                               if (link.getDestination().getDestTp().hashCode() > link.getSource()
-                                       .getSourceTp().hashCode()) {
-                                   linkAddedKey = link.getSource().getSourceTp().getValue()
-                                       + link.getDestination().getDestTp().getValue();
-                               } else {
-                                   linkAddedKey = link.getDestination().getDestTp().getValue()
-                                       + link.getSource().getSourceTp().getValue();
-                               }
-                               if (linkAdded.contains(linkAddedKey)) {
-                                       linkAdded.remove(linkAddedKey);
-                               }
-                               this.networkGraph.removeEdge((Link) originalData.get(iid));
+                        if (link.getDestination().getDestTp().hashCode() > link.getSource()
+                        .getSourceTp().hashCode()) {
+                        linkAddedKey = link.getSource().getSourceTp().getValue()
+                    + link.getDestination().getDestTp().getValue();
+                        } else {
+                        linkAddedKey = link.getDestination().getDestTp().getValue()
+                    + link.getSource().getSourceTp().getValue();
+                        }
+                        if (linkAdded.contains(linkAddedKey)) {
+                            linkAdded.remove(linkAddedKey);
+                        }
+                this.networkGraph.removeEdge((Link) originalData.get(iid));
                                 networkGraphFlag.set(true);
-                
-                       } 
-               }
-
-               for (Map.Entry<InstanceIdentifier<?>, DataObject> entrySet : updatedData
-                               .entrySet()) {
-            
-                       InstanceIdentifier<?> iiD = entrySet.getKey();
-                       final DataObject dataObject = entrySet.getValue();
-                       if (dataObject instanceof HostNode) {
+
+            }
+        }
+
+        for (Map.Entry<InstanceIdentifier<?>, DataObject> entrySet : updatedData
+                .entrySet()) {
+
+            InstanceIdentifier<?> iiD = entrySet.getKey();
+            final DataObject dataObject = entrySet.getValue();
+            if (dataObject instanceof HostNode) {
                                 log.info("update hostnode data");
-                               processNode((HostNode) dataObject);
-                       }
-               }
-
-               for (Map.Entry<InstanceIdentifier<?>, DataObject> entrySet : createdData
-                               .entrySet()) {
-                       InstanceIdentifier<?> iiD = entrySet.getKey();
-                       final DataObject dataObject = entrySet.getValue();
-                       if (dataObject instanceof HostNode) {
+                processNode((HostNode) dataObject);
+            }
+        }
+
+        for (Map.Entry<InstanceIdentifier<?>, DataObject> entrySet : createdData
+                .entrySet()) {
+            InstanceIdentifier<?> iiD = entrySet.getKey();
+            final DataObject dataObject = entrySet.getValue();
+            if (dataObject instanceof HostNode) {
                                 log.info("update HostNode");
-                               processNode((HostNode) dataObject);
-                       } else if (dataObject instanceof Link) {
+                processNode((HostNode) dataObject);
+            } else if (dataObject instanceof Link) {
                                 log.info("update link");
-                               Link link = (Link) dataObject;
-                               if (!linkAlreadyAdded(link)) {
-                                       NodeId sourceNodeId = link.getSource().getSourceNode();
-                                       NodeId destinationNodeId = link.getDestination()
-                                                       .getDestNode();
-                                       this.networkGraph.addVertex(sourceNodeId);
-                                       this.networkGraph.addVertex(destinationNodeId);
-                                       this.networkGraph.addEdge(link, sourceNodeId, destinationNodeId,
-                                                       EdgeType.UNDIRECTED);
+                Link link = (Link) dataObject;
+                if (!linkAlreadyAdded(link)) {
+                    NodeId sourceNodeId = link.getSource().getSourceNode();
+                    NodeId destinationNodeId = link.getDestination()
+                            .getDestNode();
+                    this.networkGraph.addVertex(sourceNodeId);
+                    this.networkGraph.addVertex(destinationNodeId);
+                    this.networkGraph.addEdge(link, sourceNodeId, destinationNodeId,
+                            EdgeType.UNDIRECTED);
                                         log.info("update link in networkGraph");
                                         networkGraphFlag.set(true);
-                               }
-                       } 
-               }
-           
-        
+                }
+            }
+        }
+
+
     }
 
     public List<EndpointCostMap> hopcountNumerical(List<TypedEndpointAddress> srcs, List<TypedEndpointAddress> dsts) {
@@ -340,59 +340,59 @@ public class AltoProvider implements
                     shortestPath = new DijkstraShortestPath(this.networkGraph);
                     networkGraphFlag.set(false);
                 }
-               List<EndpointCostMap> result = new ArrayList<EndpointCostMap>();
-               for (int i = 0; i < srcs.size(); ++i) {
-                       TypedEndpointAddress teaSrc = srcs.get(i);
-                       String ipv4SrcString = teaSrc.getTypedIpv4Address().getValue()
-                                       .substring(5);
-                       String tpIdSrc = this.ipSwitchIdMap.get(ipv4SrcString);
-                       String[] tempi = tpIdSrc.split(":");
-                       String swSrcId = tempi[0] + ":" + tempi[1];
-                       List<DstCosts> dstCostsList = new ArrayList<DstCosts>();
-
-                       for (int j = 0; j < dsts.size(); ++j) {
-                               TypedEndpointAddress teaDst = dsts.get(j);
-                               String ipv4DstString = teaDst.getTypedIpv4Address().getValue()
-                                               .substring(5);
-                               String tpIdDst = this.ipSwitchIdMap.get(ipv4DstString);
-                               String[] tempj = tpIdDst.split(":");
-                               String swDstId = tempj[0] + ":" + tempj[1];
-
-                               NodeId srcNodeId = new NodeId(swSrcId);
-                               NodeId dstNodeId = new NodeId(swDstId);
-                               Number number = shortestPath.getDistance(srcNodeId, dstNodeId);
+        List<EndpointCostMap> result = new ArrayList<EndpointCostMap>();
+        for (int i = 0; i < srcs.size(); ++i) {
+            TypedEndpointAddress teaSrc = srcs.get(i);
+            String ipv4SrcString = teaSrc.getTypedIpv4Address().getValue()
+                    .substring(5);
+            String tpIdSrc = this.ipSwitchIdMap.get(ipv4SrcString);
+            String[] tempi = tpIdSrc.split(":");
+            String swSrcId = tempi[0] + ":" + tempi[1];
+            List<DstCosts> dstCostsList = new ArrayList<DstCosts>();
+
+            for (int j = 0; j < dsts.size(); ++j) {
+                TypedEndpointAddress teaDst = dsts.get(j);
+                String ipv4DstString = teaDst.getTypedIpv4Address().getValue()
+                        .substring(5);
+                String tpIdDst = this.ipSwitchIdMap.get(ipv4DstString);
+                String[] tempj = tpIdDst.split(":");
+                String swDstId = tempj[0] + ":" + tempj[1];
+
+                NodeId srcNodeId = new NodeId(swSrcId);
+                NodeId dstNodeId = new NodeId(swDstId);
+                Number number = shortestPath.getDistance(srcNodeId, dstNodeId);
                                 DstCosts1 dst1 = null;
                                 if (number!=null) {
-                                   dst1 = new DstCosts1Builder().setCostDefault(number.intValue()).build();
+                    dst1 = new DstCosts1Builder().setCostDefault(number.intValue()).build();
                                 }
                                 else {
                                     dst1 = new DstCosts1Builder().setCostDefault(Integer.MAX_VALUE).build();
                                 }
-                               DstCosts dstCost = new DstCostsBuilder()
-                                               .addAugmentation(DstCosts1.class, dst1).setDst(teaDst)
-                                               .build();
-                               dstCostsList.add(dstCost);
-                       }
-                       EndpointCostMap ecp = new EndpointCostMapBuilder().setSrc(teaSrc)
-                                       .setDstCosts(dstCostsList)
-                                       .setKey(new EndpointCostMapKey(teaSrc)).build();
-                       result.add(ecp);
-               }
-               return result;
-       }
-    
+                DstCosts dstCost = new DstCostsBuilder()
+                        .addAugmentation(DstCosts1.class, dst1).setDst(teaDst)
+                        .build();
+                dstCostsList.add(dstCost);
+            }
+            EndpointCostMap ecp = new EndpointCostMapBuilder().setSrc(teaSrc)
+                    .setDstCosts(dstCostsList)
+                    .setKey(new EndpointCostMapKey(teaSrc)).build();
+            result.add(ecp);
+        }
+        return result;
+    }
+
     @Override
     public Future<RpcResult<EndpointCostServiceOutput>> endpointCostService(
             EndpointCostServiceInput input) {
-       
+
         CostType costTypeInput = null;
         List<Constraint> constraintsInput = null;
         Endpoints endpointsInput = null;
-       
+
         RpcResultBuilder<EndpointCostServiceOutput> endpointCostServiceBuilder = null;
 
         EndpointCostServiceOutput output = null;
-        
+
         if ((costTypeInput = input.getCostType()) == null) {
             endpointCostServiceBuilder = RpcResultBuilder.<EndpointCostServiceOutput>failed().withError(ErrorType.APPLICATION, "Invalid cost-type value ", "Argument can not be null.");
         }
@@ -401,40 +401,40 @@ public class AltoProvider implements
                 endpointCostServiceBuilder = RpcResultBuilder.<EndpointCostServiceOutput>failed().withError(ErrorType.APPLICATION, "Invalid endpoints value ", "Argument can not be null.");
             }
             else {
-               Endpoints endpoints = input.getEndpoints();
-               List<TypedEndpointAddress> srcs = endpoints.getSrcs();
-               List<TypedEndpointAddress> dsts = endpoints.getDsts();
+                Endpoints endpoints = input.getEndpoints();
+                List<TypedEndpointAddress> srcs = endpoints.getSrcs();
+                List<TypedEndpointAddress> dsts = endpoints.getDsts();
                 boolean srcDstFoundFlag = true;
-               for (int i = 0; i < srcs.size(); ++i) {
-                       TypedEndpointAddress teaSrc = srcs.get(i);
-                               String ipv4SrcString = teaSrc.getTypedIpv4Address().getValue()
-                                               .substring(5);
+                for (int i = 0; i < srcs.size(); ++i) {
+                    TypedEndpointAddress teaSrc = srcs.get(i);
+                    String ipv4SrcString = teaSrc.getTypedIpv4Address().getValue()
+                            .substring(5);
                     if (this.ipSwitchIdMap.get(ipv4SrcString) == null) {
-                       endpointCostServiceBuilder = RpcResultBuilder.<EndpointCostServiceOutput>failed().withError(ErrorType.APPLICATION, "Invalid endpoints value ", "src IP:"+ipv4SrcString+ " can not be found. Or Topology has not been built.");
+                        endpointCostServiceBuilder = RpcResultBuilder.<EndpointCostServiceOutput>failed().withError(ErrorType.APPLICATION, "Invalid endpoints value ", "src IP:"+ipv4SrcString+ " can not be found. Or Topology has not been built.");
                         srcDstFoundFlag = false;
                         return Futures.immediateFuture(endpointCostServiceBuilder.build());
-                    }                          
-               }
-               for (int j = 0; j < dsts.size(); ++j) {
-                               TypedEndpointAddress teaDst = dsts.get(j);
-                               String ipv4DstString = teaDst.getTypedIpv4Address().getValue()
-                                               .substring(5);
-                               if (this.ipSwitchIdMap.get(ipv4DstString) == null) {
-                                       endpointCostServiceBuilder = RpcResultBuilder.<EndpointCostServiceOutput>failed().withError(ErrorType.APPLICATION, "Invalid endpoints value ", "dst IP:"+ipv4DstString+" can not be found. Or Topology has not been built.");
+                    }
+                }
+                for (int j = 0; j < dsts.size(); ++j) {
+                    TypedEndpointAddress teaDst = dsts.get(j);
+                    String ipv4DstString = teaDst.getTypedIpv4Address().getValue()
+                            .substring(5);
+                    if (this.ipSwitchIdMap.get(ipv4DstString) == null) {
+                        endpointCostServiceBuilder = RpcResultBuilder.<EndpointCostServiceOutput>failed().withError(ErrorType.APPLICATION, "Invalid endpoints value ", "dst IP:"+ipv4DstString+" can not be found. Or Topology has not been built.");
                         srcDstFoundFlag = false;
                         return Futures.immediateFuture(endpointCostServiceBuilder.build());
-                               }
-               }
+                    }
+                }
                 CostMetric costMetric = costTypeInput.getCostMetric();
                 CostMode costMode = costTypeInput.getCostMode();
                 if (srcDstFoundFlag && costMode.equals(CostMode.Numerical) && (costMetric.getEnumeration() == CostMetric.Enumeration.Hopcount || costMetric.getString().equals("hopcount"))){
-                       org.opendaylight.yang.gen.v1.urn.opendaylight.alto.rev150404.endpoint.cost.service.output.endpoint.cost.service.meta.CostType costType = new org.opendaylight.yang.gen.v1.urn.opendaylight.alto.rev150404.endpoint.cost.service.output.endpoint.cost.service.meta.CostTypeBuilder()
-                       .setCostMetric(costMetric)
-                       .setCostMode(costMode).build();
-                       Meta meta = new MetaBuilder().setCostType(costType).build();
-                       List<EndpointCostMap> ecmList = hopcountNumerical(srcs, dsts);
-                       EndpointCostService ecs = new EndpointCostServiceBuilder().setMeta(meta).setEndpointCostMap(ecmList).build();
-                       
+                    org.opendaylight.yang.gen.v1.urn.opendaylight.alto.rev150404.endpoint.cost.service.output.endpoint.cost.service.meta.CostType costType = new org.opendaylight.yang.gen.v1.urn.opendaylight.alto.rev150404.endpoint.cost.service.output.endpoint.cost.service.meta.CostTypeBuilder()
+                    .setCostMetric(costMetric)
+                    .setCostMode(costMode).build();
+                    Meta meta = new MetaBuilder().setCostType(costType).build();
+                    List<EndpointCostMap> ecmList = hopcountNumerical(srcs, dsts);
+                    EndpointCostService ecs = new EndpointCostServiceBuilder().setMeta(meta).setEndpointCostMap(ecmList).build();
+
                     if ((output = new EndpointCostServiceOutputBuilder().setEndpointCostService(ecs).build()) != null) {
                         endpointCostServiceBuilder = RpcResultBuilder.success(output);
                     }
@@ -442,13 +442,13 @@ public class AltoProvider implements
                         endpointCostServiceBuilder = RpcResultBuilder.<EndpointCostServiceOutput>failed().withError(ErrorType.APPLICATION, "Invalid output value", "Output is null.");
                     }
                     return Futures.immediateFuture(endpointCostServiceBuilder.build());
-                
+
                 }
-                
+
             }
         }
         return Futures.immediateFuture(RpcResultBuilder.<EndpointCostServiceOutput>failed().withError(ErrorType.APPLICATION, "Invalid output value", "Output is null.").build());
-  
+
     }
 
     @Override
@@ -467,10 +467,10 @@ public class AltoProvider implements
 
     @Override
     public void close() throws ExecutionException, InterruptedException {
-       this.hostNodeListerRegistration.close();
-       this.linkListerRegistration.close();
-               this.ipSwitchIdMap.clear();
-       executor.shutdown();
+        this.hostNodeListerRegistration.close();
+        this.linkListerRegistration.close();
+        this.ipSwitchIdMap.clear();
+        executor.shutdown();
         if (dataProvider != null) {
             WriteTransaction tx = dataProvider.newWriteOnlyTransaction();
             tx.delete(LogicalDatastoreType.CONFIGURATION, ALTO_IID);
index 07d6943bbb6f5616f20c571b0595cdc8287d650c..13041c139c73532ec1d08cd040e75edd9d596f27 100644 (file)
@@ -25,7 +25,6 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.alto.rev150404.endpoint.cos
 import org.opendaylight.yang.gen.v1.urn.opendaylight.alto.costdefault.rev150507.DstCosts1;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.alto.costdefault.rev150507.DstCosts1Builder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.alto.service.types.rev150404.TypedEndpointAddress;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.alto.service.types.rev150404.TypedEndpointAddressBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.alto.service.types.rev150404.TypedIpv4Address;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.host.tracker.rev140624.HostNode;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.host.tracker.rev140624.HostNodeBuilder;
@@ -49,7 +48,6 @@ import org.junit.Assert;
 import org.junit.Before;
 import org.junit.Test;
 
-import static org.mockito.Mockito.verify;
 import static org.mockito.Mockito.mock;
 
 public class AltoProviderTest {
@@ -59,111 +57,111 @@ public class AltoProviderTest {
   private DataBroker dataBroker;
   private IpAddress ipAddress;
   private MacAddress mac;
-  
+
 
   @Before
   public void init(){
     dataBroker = mock(DataBroker.class);
     altoProvider = new AltoProvider();
   }
-  
+
   @Test
   public void onProcessTopology() throws Exception {
-         IpAddress ipAddress1 = new IpAddress(new Ipv4Address("10.0.0.1"));
-         MacAddress mac1 = new MacAddress("00:00:00:00:00:01");
-         Addresses addrs1 = new AddressesBuilder().setIp(ipAddress1).setMac(mac1).build();
-         List<Addresses> addrsList1 = new ArrayList<Addresses>();
-         addrsList1.add(addrs1);
-         
-         AttachmentPoints ap1 = new AttachmentPointsBuilder().setTpId(new TpId("openflow:1:1")).build();
-         List<AttachmentPoints> apList1 = new ArrayList<AttachmentPoints>();
-         apList1.add(ap1);
-         HostNode hostNode1 = new HostNodeBuilder().setAddresses(addrsList1).setAttachmentPoints(apList1).build();
-         
-         IpAddress ipAddress2 = new IpAddress(new Ipv4Address("10.0.0.2"));
-         MacAddress mac2 = new MacAddress("00:00:00:00:00:02");
-         Addresses addrs2 = new AddressesBuilder().setIp(ipAddress2).setMac(mac2).build();
-         List<Addresses> addrsList2 = new ArrayList<Addresses>();
-         addrsList2.add(addrs2);
-         
-         AttachmentPoints ap2 = new AttachmentPointsBuilder().setTpId(new TpId("openflow:2:1")).build();
-         List<AttachmentPoints> apList2 = new ArrayList<AttachmentPoints>();
-         apList2.add(ap2);
-         HostNode hostNode2 = new HostNodeBuilder().setAddresses(addrsList2).setAttachmentPoints(apList2).build();
-         
-         
-         Node node1 = new NodeBuilder().addAugmentation(HostNode.class, hostNode1).build();
-         Node node2 = new NodeBuilder().addAugmentation(HostNode.class, hostNode2).build();
-         
-         Node sw1 = new NodeBuilder().setNodeId(new NodeId("openflow:1")).build();
-         Node sw2 = new NodeBuilder().setNodeId(new NodeId("openflow:2")).build();
-         Node sw3 = new NodeBuilder().setNodeId(new NodeId("openflow:3")).build();
-         
-         Destination SW1_2 = new DestinationBuilder().setDestNode(new NodeId("openflow:1"))
-                         .setDestTp(new TpId("openflow:1:2")).build();
-         Source SW3_1 = new SourceBuilder().setSourceNode(new NodeId("openflow:3"))
-                         .setSourceTp(new TpId("openflow:3:1")).build();
-         Link l1 = new LinkBuilder().setLinkId(new LinkId("link1"))
-                         .setDestination(SW1_2)
-                         .setSource(SW3_1).build();
-         
-         Destination SW1_3 = new DestinationBuilder().setDestNode(new NodeId("openflow:1"))
-                         .setDestTp(new TpId("openflow:1:3")).build();
-         Source SW2_2 = new SourceBuilder().setSourceNode(new NodeId("openflow:2"))
-                         .setSourceTp(new TpId("openflow:2:2")).build();
-         Link l2 = new LinkBuilder().setLinkId(new LinkId("link2"))
-                         .setDestination(SW1_3)
-                         .setSource(SW2_2).build();
-         
-         Destination SW3_2 = new DestinationBuilder().setDestNode(new NodeId("openflow:3"))
-                         .setDestTp(new TpId("openflow:3:2")).build();
-         Source SW2_3 = new SourceBuilder().setSourceNode(new NodeId("openflow:2"))
-                         .setSourceTp(new TpId("openflow:2:3")).build();
-         Link l3 = new LinkBuilder().setLinkId(new LinkId("link3"))
-                         .setDestination(SW3_2)
-                         .setSource(SW2_3).build();
-         
-         List<Node> nodeList = new ArrayList<Node>();
-         nodeList.add(node1);
-         nodeList.add(node2);
-         nodeList.add(sw1);
-         nodeList.add(sw2);
-         nodeList.add(sw3);
-         
-         List<Link> linkList = new ArrayList<Link>();
-         linkList.add(l1);
-         linkList.add(l2);
-         linkList.add(l3);
-         
-         Topology topology = new TopologyBuilder().setTopologyId(new TopologyId("flow:1"))
-                         .setLink(linkList)
-                         .setNode(nodeList).build();
-         
-         altoProvider.processTopology(topology);
-         
-         TypedIpv4Address ipv4_1 = new TypedIpv4Address("ipv4:10.0.0.1");
-         TypedEndpointAddress tea1 = new TypedEndpointAddress(ipv4_1);
-         
-         List<TypedEndpointAddress> teaList1 = new ArrayList<TypedEndpointAddress>();
-         teaList1.add(tea1);
-         
-         TypedIpv4Address ipv4_2 = new TypedIpv4Address("ipv4:10.0.0.2");
-         TypedEndpointAddress tea2 = new TypedEndpointAddress(ipv4_2);
-         
-         List<TypedEndpointAddress> teaList2 = new ArrayList<TypedEndpointAddress>();
-         teaList2.add(tea2);
-         
-         DstCosts1 dc1 = new DstCosts1Builder().setCostDefault(1).build();
-         DstCosts dc = new DstCostsBuilder().setDst(tea2).addAugmentation(DstCosts1.class, dc1).build();
-         
-         List<DstCosts> dcList = new ArrayList<DstCosts>();
-         dcList.add(dc);
-         
-         EndpointCostMap ecp = new EndpointCostMapBuilder().setSrc(tea1).setDstCosts(dcList).build();
-         List<EndpointCostMap> ecpList = new ArrayList<EndpointCostMap>();
-         ecpList.add(ecp);
-         
-         Assert.assertEquals(altoProvider.hopcountNumerical(teaList1, teaList2), ecpList);  
+      IpAddress ipAddress1 = new IpAddress(new Ipv4Address("10.0.0.1"));
+      MacAddress mac1 = new MacAddress("00:00:00:00:00:01");
+      Addresses addrs1 = new AddressesBuilder().setIp(ipAddress1).setMac(mac1).build();
+      List<Addresses> addrsList1 = new ArrayList<Addresses>();
+      addrsList1.add(addrs1);
+
+      AttachmentPoints ap1 = new AttachmentPointsBuilder().setTpId(new TpId("openflow:1:1")).build();
+      List<AttachmentPoints> apList1 = new ArrayList<AttachmentPoints>();
+      apList1.add(ap1);
+      HostNode hostNode1 = new HostNodeBuilder().setAddresses(addrsList1).setAttachmentPoints(apList1).build();
+
+      IpAddress ipAddress2 = new IpAddress(new Ipv4Address("10.0.0.2"));
+      MacAddress mac2 = new MacAddress("00:00:00:00:00:02");
+      Addresses addrs2 = new AddressesBuilder().setIp(ipAddress2).setMac(mac2).build();
+      List<Addresses> addrsList2 = new ArrayList<Addresses>();
+      addrsList2.add(addrs2);
+
+      AttachmentPoints ap2 = new AttachmentPointsBuilder().setTpId(new TpId("openflow:2:1")).build();
+      List<AttachmentPoints> apList2 = new ArrayList<AttachmentPoints>();
+      apList2.add(ap2);
+      HostNode hostNode2 = new HostNodeBuilder().setAddresses(addrsList2).setAttachmentPoints(apList2).build();
+
+
+      Node node1 = new NodeBuilder().addAugmentation(HostNode.class, hostNode1).build();
+      Node node2 = new NodeBuilder().addAugmentation(HostNode.class, hostNode2).build();
+
+      Node sw1 = new NodeBuilder().setNodeId(new NodeId("openflow:1")).build();
+      Node sw2 = new NodeBuilder().setNodeId(new NodeId("openflow:2")).build();
+      Node sw3 = new NodeBuilder().setNodeId(new NodeId("openflow:3")).build();
+
+      Destination SW1_2 = new DestinationBuilder().setDestNode(new NodeId("openflow:1"))
+              .setDestTp(new TpId("openflow:1:2")).build();
+      Source SW3_1 = new SourceBuilder().setSourceNode(new NodeId("openflow:3"))
+              .setSourceTp(new TpId("openflow:3:1")).build();
+      Link l1 = new LinkBuilder().setLinkId(new LinkId("link1"))
+              .setDestination(SW1_2)
+              .setSource(SW3_1).build();
+
+      Destination SW1_3 = new DestinationBuilder().setDestNode(new NodeId("openflow:1"))
+              .setDestTp(new TpId("openflow:1:3")).build();
+      Source SW2_2 = new SourceBuilder().setSourceNode(new NodeId("openflow:2"))
+              .setSourceTp(new TpId("openflow:2:2")).build();
+      Link l2 = new LinkBuilder().setLinkId(new LinkId("link2"))
+              .setDestination(SW1_3)
+              .setSource(SW2_2).build();
+
+      Destination SW3_2 = new DestinationBuilder().setDestNode(new NodeId("openflow:3"))
+              .setDestTp(new TpId("openflow:3:2")).build();
+      Source SW2_3 = new SourceBuilder().setSourceNode(new NodeId("openflow:2"))
+              .setSourceTp(new TpId("openflow:2:3")).build();
+      Link l3 = new LinkBuilder().setLinkId(new LinkId("link3"))
+              .setDestination(SW3_2)
+              .setSource(SW2_3).build();
+
+      List<Node> nodeList = new ArrayList<Node>();
+      nodeList.add(node1);
+      nodeList.add(node2);
+      nodeList.add(sw1);
+      nodeList.add(sw2);
+      nodeList.add(sw3);
+
+      List<Link> linkList = new ArrayList<Link>();
+      linkList.add(l1);
+      linkList.add(l2);
+      linkList.add(l3);
+
+      Topology topology = new TopologyBuilder().setTopologyId(new TopologyId("flow:1"))
+              .setLink(linkList)
+              .setNode(nodeList).build();
+
+      altoProvider.processTopology(topology);
+
+      TypedIpv4Address ipv4_1 = new TypedIpv4Address("ipv4:10.0.0.1");
+      TypedEndpointAddress tea1 = new TypedEndpointAddress(ipv4_1);
+
+      List<TypedEndpointAddress> teaList1 = new ArrayList<TypedEndpointAddress>();
+      teaList1.add(tea1);
+
+      TypedIpv4Address ipv4_2 = new TypedIpv4Address("ipv4:10.0.0.2");
+      TypedEndpointAddress tea2 = new TypedEndpointAddress(ipv4_2);
+
+      List<TypedEndpointAddress> teaList2 = new ArrayList<TypedEndpointAddress>();
+      teaList2.add(tea2);
+
+      DstCosts1 dc1 = new DstCosts1Builder().setCostDefault(1).build();
+      DstCosts dc = new DstCostsBuilder().setDst(tea2).addAugmentation(DstCosts1.class, dc1).build();
+
+      List<DstCosts> dcList = new ArrayList<DstCosts>();
+      dcList.add(dc);
+
+      EndpointCostMap ecp = new EndpointCostMapBuilder().setSrc(tea1).setDstCosts(dcList).build();
+      List<EndpointCostMap> ecpList = new ArrayList<EndpointCostMap>();
+      ecpList.add(ecp);
+
+      Assert.assertEquals(altoProvider.hopcountNumerical(teaList1, teaList2), ecpList);
   }
 
 }
index ba0796a85f63d769883679131865e52b5bc08820..776a38ffab9d7935d21b127d8581760faca33697 100644 (file)
@@ -7,14 +7,12 @@ import org.opendaylight.alto.commons.types.rfc7285.RFC7285NetworkMap;
 import org.opendaylight.alto.commons.types.rfc7285.RFC7285Endpoint;
 import org.opendaylight.alto.commons.types.rfc7285.RFC7285VersionTag;
 import org.opendaylight.alto.commons.types.rfc7285.RFC7285CostMap;
-import org.opendaylight.alto.commons.types.rfc7285.RFC7285VersionTag;
 import org.opendaylight.alto.commons.types.rfc7285.RFC7285CostType;
 
 import org.opendaylight.alto.commons.types.converter.YANGJSON2RFCNetworkMapConverter;
 import org.opendaylight.alto.commons.types.converter.YANGJSON2RFCCostMapConverter;
 
 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import org.opendaylight.yangtools.yang.binding.Augmentable;
 import org.opendaylight.yangtools.yang.binding.Augmentation;
 import org.opendaylight.yangtools.yang.binding.util.BindingReflections;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.alto.rev150404.Resources;
@@ -32,17 +30,12 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.alto.service.types.rev15040
 
 import org.opendaylight.controller.md.sal.binding.api.DataBroker;
 import org.opendaylight.controller.md.sal.binding.api.ReadOnlyTransaction;
-import org.opendaylight.controller.md.sal.binding.api.WriteTransaction;
-import org.opendaylight.controller.md.sal.binding.api.ReadWriteTransaction;
 import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
 
 import org.opendaylight.controller.sal.utils.ServiceHelper;
 import org.osgi.framework.ServiceRegistration;
 
 import com.google.common.base.Optional;
-import com.google.common.util.concurrent.AsyncFunction;
-import com.google.common.util.concurrent.FutureCallback;
-import com.google.common.util.concurrent.Futures;
 import com.google.common.util.concurrent.ListenableFuture;
 
 import java.util.Iterator;
@@ -223,7 +216,7 @@ public class SimpleAltoService implements NetworkMapService, CostMapService, Aut
 
 
     @Override
-       public RFC7285CostMap getCostMap(String id) {
+    public RFC7285CostMap getCostMap(String id) {
         m_logger.info("Handling cost-map resource: {}", id);
         InstanceIdentifier<CostMap> ciid = getCostMapIID(id);
         m_logger.info("CostMap IID: {}", ciid);
@@ -250,13 +243,13 @@ public class SimpleAltoService implements NetworkMapService, CostMapService, Aut
     }
 
     @Override
-       public RFC7285CostMap getCostMap(RFC7285VersionTag vtag) {
+    public RFC7285CostMap getCostMap(RFC7285VersionTag vtag) {
         //TODO
         return null;
     }
 
     @Override
-       public RFC7285CostMap getCostMap(String id, RFC7285CostType type) {
+    public RFC7285CostMap getCostMap(String id, RFC7285CostType type) {
         RFC7285CostMap cm = getCostMap(id);
         if (cm == null)
             return null;
@@ -266,13 +259,13 @@ public class SimpleAltoService implements NetworkMapService, CostMapService, Aut
     }
 
     @Override
-       public RFC7285CostMap getCostMap(RFC7285VersionTag vtag, RFC7285CostType type) {
+    public RFC7285CostMap getCostMap(RFC7285VersionTag vtag, RFC7285CostType type) {
         //TODO
         return null;
     }
 
     @Override
-       public RFC7285CostMap getCostMap(String id, RFC7285CostMap.Filter filter) {
+    public RFC7285CostMap getCostMap(String id, RFC7285CostMap.Filter filter) {
         RFC7285CostMap cm = null;
         if (filter.costType != null) {
             cm = getCostMap(id, filter.costType);
@@ -315,31 +308,31 @@ public class SimpleAltoService implements NetworkMapService, CostMapService, Aut
     }
 
     @Override
-       public RFC7285CostMap getCostMap(RFC7285VersionTag vtag, RFC7285CostMap.Filter filter) {
+    public RFC7285CostMap getCostMap(RFC7285VersionTag vtag, RFC7285CostMap.Filter filter) {
         //TODO
         return null;
     }
 
     @Override
-       public Boolean supportCostType(String id, RFC7285CostType type) {
+    public Boolean supportCostType(String id, RFC7285CostType type) {
         //TODO
         return true;
     }
 
     @Override
-       public Boolean supportCostType(RFC7285VersionTag vtag, RFC7285CostType type) {
+    public Boolean supportCostType(RFC7285VersionTag vtag, RFC7285CostType type) {
         //TODO
         return true;
     }
 
     @Override
-       public Boolean validateCostMapFilter(String id, RFC7285CostMap.Filter filter) {
+    public Boolean validateCostMapFilter(String id, RFC7285CostMap.Filter filter) {
         //TODO
         return true;
     }
 
     @Override
-       public Boolean validateCostMapFilter(RFC7285VersionTag vtag, RFC7285CostMap.Filter filter) {
+    public Boolean validateCostMapFilter(RFC7285VersionTag vtag, RFC7285CostMap.Filter filter) {
         //TODO
         return true;
     }
diff --git a/pom.xml b/pom.xml
index 09bdb1b0e793ea19768d20452da6baa21fa2d5b9..7cdb53b6448eee2c81ba697e428c7d6c3d381e8a 100644 (file)
--- a/pom.xml
+++ b/pom.xml
@@ -37,7 +37,6 @@
   <properties>
     <odl.version>1.5.0-SNAPSHOT</odl.version>
     <karaf.shell.version>2.2.11</karaf.shell.version>
-    <checkstyle.skip>true</checkstyle.skip>
 
     <!-- required by alto command line -->
     <httpclient.version>4.4.1</httpclient.version>