Fixup Augmentable and Identifiable methods changing
[openflowplugin.git] / applications / bulk-o-matic / src / main / java / org / opendaylight / openflowplugin / applications / bulk / o / matic / BulkOMaticUtils.java
index 8c80b15b03653c6d7c03a5e22f1d4d0e0ccaab3b..60114cf99e6a74fd068a69d12dd9690f192cf6bd 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016 Ericsson Systems, Inc. and others.  All rights reserved.
+ * Copyright (c) 2016, 2017 Ericsson Systems, Inc. and others.  All rights reserved.
  *
  * This program and the accompanying materials are made available under the
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
@@ -32,6 +32,7 @@ public final class BulkOMaticUtils {
 
     public static final int DEFUALT_STATUS = FlowCounter.OperationStatus.INIT.status();
     public static final int DEFAULT_FLOW_COUNT = 0;
+    public static final int DEFAULT_TABLE_COUNT = 0;
     public static final long DEFAULT_COMPLETION_TIME = 0;
     public static final String DEFAULT_UNITS = "ns";
     public static final String DEVICE_TYPE_PREFIX = "openflow:";
@@ -39,16 +40,15 @@ public final class BulkOMaticUtils {
     private BulkOMaticUtils() {
     }
 
-    public static String ipIntToStr (int k) {
-        return new StringBuilder().append(k >> 24 & 0xFF).append(".")
-                .append(k >> 16 & 0xFF).append(".")
-                .append(k >> 8 & 0xFF).append(".")
-                .append(k & 0xFF).append("/32").toString();
+    public static String ipIntToStr(int number) {
+        return new StringBuilder().append(number >> 24 & 0xFF).append(".")
+                .append(number >> 16 & 0xFF).append(".")
+                .append(number >> 8 & 0xFF).append(".")
+                .append(number & 0xFF).append("/32").toString();
     }
 
-    public static Match getMatch(final Integer sourceIp){
-        Ipv4Match ipv4Match = new Ipv4MatchBuilder().setIpv4Source(
-                new Ipv4Prefix(ipIntToStr(sourceIp))).build();
+    public static Match getMatch(final int sourceIp) {
+        Ipv4Match ipv4Match = new Ipv4MatchBuilder().setIpv4Source(new Ipv4Prefix(ipIntToStr(sourceIp))).build();
         MatchBuilder matchBuilder = new MatchBuilder();
         matchBuilder.setLayer3Match(ipv4Match);
         EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
@@ -59,35 +59,28 @@ public final class BulkOMaticUtils {
         return matchBuilder.build();
     }
 
-    public static Flow buildFlow(Short tableId, String flowId, Match match){
+    public static Flow buildFlow(Short tableId, String flowId, Match match) {
         FlowBuilder flowBuilder = new FlowBuilder();
-        flowBuilder.setKey(new FlowKey(new FlowId(flowId)));
+        flowBuilder.withKey(new FlowKey(new FlowId(flowId)));
         flowBuilder.setTableId(tableId);
         flowBuilder.setMatch(match);
         return flowBuilder.build();
     }
 
     public static InstanceIdentifier<Flow> getFlowInstanceIdentifier(Short tableId, String flowId, String dpId) {
-        return InstanceIdentifier.create(Nodes.class).child(Node.class,
-                new NodeKey(new NodeId(dpId)))
-                .augmentation(FlowCapableNode.class)
-                .child(Table.class, new TableKey(tableId))
+        return InstanceIdentifier.create(Nodes.class).child(Node.class, new NodeKey(new NodeId(dpId)))
+                .augmentation(FlowCapableNode.class).child(Table.class, new TableKey(tableId))
                 .child(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.Flow.class,
                         new FlowKey(new FlowId(flowId)));
     }
 
-    public static InstanceIdentifier<Node> getFlowCapableNodeId(String dpId){
-        return InstanceIdentifier.builder(Nodes.class)
-                .child(Node.class, new NodeKey(new NodeId(dpId)))
-                .build();
+    public static InstanceIdentifier<Node> getFlowCapableNodeId(String dpId) {
+        return InstanceIdentifier.builder(Nodes.class).child(Node.class, new NodeKey(new NodeId(dpId))).build();
     }
 
     public static InstanceIdentifier<Table> getTableId(Short tableId, String dpId) {
-        return InstanceIdentifier.builder(Nodes.class)
-                .child(Node.class, new NodeKey(new NodeId(dpId)))
-                .augmentation(FlowCapableNode.class)
-                .child(Table.class, new TableKey(tableId))
-                .build();
+        return InstanceIdentifier.builder(Nodes.class).child(Node.class, new NodeKey(new NodeId(dpId)))
+                .augmentation(FlowCapableNode.class).child(Table.class, new TableKey(tableId)).build();
     }
 
     public static InstanceIdentifier<Flow> getFlowId(final InstanceIdentifier<Table> tablePath, final String flowId) {