* terms of the Eclipse Public License v1.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
-
package org.opendaylight.openflowplugin.test;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.errors.rev131116.ErrorType;
notification.getTransactionId().getValue()));
}
- private String toStr(ErrorType type, Uint16 code, Uint64 xid) {
+ private static String toStr(ErrorType type, Uint16 code, Uint64 xid) {
return "[Type=" + type + ", Code=" + code + ", Xid =" + xid + "]";
}
}
import com.google.common.util.concurrent.FutureCallback;
import com.google.common.util.concurrent.MoreExecutors;
-import java.math.BigInteger;
import java.util.ArrayList;
import java.util.List;
import org.eclipse.osgi.framework.console.CommandInterpreter;
import org.opendaylight.mdsal.binding.api.DataBroker;
import org.opendaylight.mdsal.binding.api.NotificationService;
import org.opendaylight.mdsal.binding.api.ReadWriteTransaction;
+import org.opendaylight.mdsal.common.api.CommitInfo;
import org.opendaylight.mdsal.common.api.LogicalDatastoreType;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Prefix;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress;
import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.Ipv4MatchBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.node.error.service.rev140410.NodeErrorListener;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.common.Uint16;
+import org.opendaylight.yangtools.yang.common.Uint32;
+import org.opendaylight.yangtools.yang.common.Uint64;
+import org.opendaylight.yangtools.yang.common.Uint8;
import org.osgi.framework.BundleContext;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
EthernetMatchBuilder eth = new EthernetMatchBuilder();
EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
- ethTypeBuilder.setType(new EtherType(0x0800L));
+ ethTypeBuilder.setType(new EtherType(Uint32.valueOf(0x0800)));
eth.setEthernetType(ethTypeBuilder.build());
match.setEthernetMatch(eth.build());
return match;
EthernetMatchBuilder eth = new EthernetMatchBuilder();
EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
- ethTypeBuilder.setType(new EtherType(0x0800L));
+ ethTypeBuilder.setType(new EtherType(Uint32.valueOf(0x0800)));
eth.setEthernetType(ethTypeBuilder.build());
match.setEthernetMatch(eth.build());
return match;
EthernetMatchBuilder ethmatch = new EthernetMatchBuilder(); // ethernettype
// match
EthernetTypeBuilder ethtype = new EthernetTypeBuilder();
- EtherType type = new EtherType(0x0800L);
+ EtherType type = new EtherType(Uint32.valueOf(0x0800));
ethmatch.setEthernetType(ethtype.setType(type).build());
EthernetDestinationBuilder ethdest = new EthernetDestinationBuilder(); // ethernet
private static InstructionsBuilder createMeterInstructions() {
MeterBuilder aab = new MeterBuilder();
- aab.setMeterId(new MeterId(1L));
+ aab.setMeterId(new MeterId(Uint32.ONE));
InstructionBuilder ib = new InstructionBuilder();
ib.setInstruction(new MeterCaseBuilder().setMeter(aab.build()).build());
List<Action> actionList = new ArrayList<>();
ActionBuilder ab = new ActionBuilder();
ControllerActionBuilder controller = new ControllerActionBuilder();
- controller.setMaxLength(5);
+ controller.setMaxLength(Uint16.valueOf(5));
ab.setAction(new ControllerActionCaseBuilder().setControllerAction(controller.build()).build());
actionList.add(ab.build());
// Create an Apply Action
ActionBuilder ab = new ActionBuilder();
SetVlanIdActionBuilder vl = new SetVlanIdActionBuilder();
- VlanId vlanId = new VlanId(4012);
+ VlanId vlanId = new VlanId(Uint16.valueOf(4012));
vl.setVlanId(vlanId);
ab.setAction(new SetVlanIdActionCaseBuilder().setSetVlanIdAction(vl.build()).build());
actionList.add(ab.build());
ActionBuilder ab = new ActionBuilder();
PushMplsActionBuilder push = new PushMplsActionBuilder();
- push.setEthernetType(0x8847);
+ push.setEthernetType(Uint16.valueOf(0x8847));
ab.setAction(new PushMplsActionCaseBuilder().setPushMplsAction(push.build()).build());
actionList.add(ab.build());
// Create an Apply Action
ActionBuilder ab = new ActionBuilder();
PushPbbActionBuilder pbb = new PushPbbActionBuilder();
- pbb.setEthernetType(0x88E7);
+ pbb.setEthernetType(Uint16.valueOf(0x88E7));
ab.setAction(new PushPbbActionCaseBuilder().setPushPbbAction(pbb.build()).build());
actionList.add(ab.build());
// Create an Apply Action
private static InstructionsBuilder createGotoTableInstructions() {
GoToTableBuilder aab = new GoToTableBuilder();
- aab.setTableId((short) 2);
+ aab.setTableId(Uint8.TWO);
InstructionBuilder ib = new InstructionBuilder();
ib.setInstruction(new GoToTableCaseBuilder().setGoToTable(aab.build()).build());
flow.setBarrier(Boolean.FALSE);
}
// flow.setBufferId(12L);
- BigInteger value = BigInteger.valueOf(10);
- BigInteger outputPort = BigInteger.valueOf(4294967295L);
- flow.setCookie(new FlowCookie(value));
- flow.setCookieMask(new FlowCookie(value));
- flow.setHardTimeout(0);
- flow.setIdleTimeout(0);
+ flow.setCookie(new FlowCookie(Uint64.TEN));
+ flow.setCookieMask(new FlowCookie(Uint64.TEN));
+ flow.setHardTimeout(Uint16.ZERO);
+ flow.setIdleTimeout(Uint16.ZERO);
flow.setInstallHw(false);
flow.setStrict(false);
flow.setContainerName(null);
flow.setFlags(new FlowModFlags(false, false, false, false, true));
flow.setId(new FlowId("12"));
flow.setTableId(getTableId(tableId));
- flow.setOutGroup(4294967295L);
+ flow.setOutGroup(Uint32.MAX_VALUE);
// set outport to OFPP_NONE (65535) to disable remove restriction for
// flow
- flow.setOutPort(outputPort);
+ flow.setOutPort(Uint64.valueOf(4294967295L));
flow.withKey(key);
- flow.setPriority(2);
+ flow.setPriority(Uint16.TWO);
flow.setFlowName(originalFlowName + "X" + flowType);
return flow;
}
- private short getTableId(String tableId) {
- short table = 2;
+ private static Uint8 getTableId(String tableId) {
+ Uint8 table = Uint8.TWO;
if (tableId == null) {
return table;
}
try {
- table = Short.parseShort(tableId);
- } catch (NumberFormatException ex) {
+ table = Uint8.valueOf(tableId);
+ } catch (IllegalArgumentException ex) {
// ignore exception and continue with default value
}
modification.mergeParentStructureMerge(LogicalDatastoreType.CONFIGURATION, nodeToInstanceId(testNode12),
testNode12);
modification.mergeParentStructureMerge(LogicalDatastoreType.CONFIGURATION, path2, group1);
- modification.commit().addCallback(new FutureCallback<Object>() {
+ modification.commit().addCallback(new FutureCallback<CommitInfo>() {
@Override
- public void onSuccess(Object notUsed) {
+ public void onSuccess(CommitInfo notUsed) {
ci.println("Status of Group Data Loaded Transaction: success.");
}
.child(Group.class, new GroupKey(group1.getGroupId()));
modification.delete(LogicalDatastoreType.OPERATIONAL, path2);
modification.delete(LogicalDatastoreType.CONFIGURATION, path2);
- modification.commit().addCallback(new FutureCallback<Object>() {
+ modification.commit().addCallback(new FutureCallback<CommitInfo>() {
@Override
- public void onSuccess(Object notUsed) {
+ public void onSuccess(CommitInfo notUsed) {
ci.println("Status of Group Data Loaded Transaction: success.");
}
GroupBuilder group = new GroupBuilder();
BucketBuilder bucket = new BucketBuilder();
- bucket.setBucketId(new BucketId((long) 12));
- bucket.withKey(new BucketKey(new BucketId((long) 12)));
+ bucket.withKey(new BucketKey(new BucketId(Uint32.valueOf(12))));
if (groupType == null) {
groupType = "g1";
}
if ("add".equals(groupmod)) {
- bucket.setWatchGroup((long) 14);
- bucket.setWatchPort((long) 1234);
- bucket.setWeight(50);
+ bucket.setWatchGroup(Uint32.valueOf(14));
+ bucket.setWatchPort(Uint32.valueOf(1234));
+ bucket.setWeight(Uint16.valueOf(50));
} else {
- bucket.setWatchGroup((long) 13);
- bucket.setWatchPort((long) 134);
- bucket.setWeight(30);
+ bucket.setWatchGroup(Uint32.valueOf(13));
+ bucket.setWatchPort(Uint32.valueOf(134));
+ bucket.setWeight(Uint16.valueOf(30));
}
- long id = Long.parseLong(strId);
- GroupKey key = new GroupKey(new GroupId(id));
+ GroupKey key = new GroupKey(new GroupId(Uint32.valueOf(strId)));
group.withKey(key);
// group.setInstall(false);
- group.setGroupId(new GroupId(id));
group.setGroupName(originalGroupName);
group.setBarrier(false);
BucketsBuilder value = new BucketsBuilder();
return group;
}
- private List<Action> createPopVlanAction() {
+ private static List<Action> createPopVlanAction() {
PopVlanActionBuilder vlanAction = new PopVlanActionBuilder();
ActionBuilder action = new ActionBuilder();
action.setAction(new PopVlanActionCaseBuilder().setPopVlanAction(vlanAction.build()).build());
return actions;
}
- private List<Action> createPushVlanAction() {
+ private static List<Action> createPushVlanAction() {
PushVlanActionBuilder vlan = new PushVlanActionBuilder();
- vlan.setEthernetType(0x8100);
- VlanId vlanId = new VlanId(2);
+ vlan.setEthernetType(Uint16.valueOf(0x8100));
+ VlanId vlanId = new VlanId(Uint16.TWO);
vlan.setVlanId(vlanId);
ActionBuilder action = new ActionBuilder();
action.setAction(new PushVlanActionCaseBuilder().setPushVlanAction(vlan.build()).build());
return actions;
}
- private List<Action> createPushMplsAction() {
+ private static List<Action> createPushMplsAction() {
PushMplsActionBuilder push = new PushMplsActionBuilder();
- push.setEthernetType(0x8847);
+ push.setEthernetType(Uint16.valueOf(0x8847));
ActionBuilder action = new ActionBuilder();
action.setAction(new PushMplsActionCaseBuilder().setPushMplsAction(push.build()).build());
List<Action> actions = new ArrayList<>();
return actions;
}
- private List<Action> createPopMplsAction() {
+ private static List<Action> createPopMplsAction() {
PopMplsActionBuilder popMplsActionBuilder = new PopMplsActionBuilder();
- popMplsActionBuilder.setEthernetType(0XB);
+ popMplsActionBuilder.setEthernetType(Uint16.valueOf(0XB));
ActionBuilder action = new ActionBuilder();
action.setAction(new PopMplsActionCaseBuilder().setPopMplsAction(popMplsActionBuilder.build()).build());
List<Action> actions = new ArrayList<>();
return actions;
}
- private List<Action> createPopPbbAction() {
+ private static List<Action> createPopPbbAction() {
PopPbbActionBuilder popPbbActionBuilder = new PopPbbActionBuilder();
ActionBuilder action = new ActionBuilder();
action.setAction(new PopPbbActionCaseBuilder().setPopPbbAction(popPbbActionBuilder.build()).build());
return actions;
}
- private List<Action> createPushPbbAction() {
+ private static List<Action> createPushPbbAction() {
PushPbbActionBuilder pbb = new PushPbbActionBuilder();
- pbb.setEthernetType(0x88E7);
+ pbb.setEthernetType(Uint16.valueOf(0x88E7));
ActionBuilder action = new ActionBuilder();
action.setAction(new PushPbbActionCaseBuilder().setPushPbbAction(pbb.build()).build());
List<Action> actions = new ArrayList<>();
return actions;
}
- private List<Action> createCopyTtlInAction() {
+ private static List<Action> createCopyTtlInAction() {
CopyTtlInBuilder ttlin = new CopyTtlInBuilder();
ActionBuilder action = new ActionBuilder();
action.setAction(new CopyTtlInCaseBuilder().setCopyTtlIn(ttlin.build()).build());
return actions;
}
- private List<Action> createCopyTtlOutAction() {
+ private static List<Action> createCopyTtlOutAction() {
CopyTtlOutBuilder ttlout = new CopyTtlOutBuilder();
ActionBuilder action = new ActionBuilder();
action.setAction(new CopyTtlOutCaseBuilder().setCopyTtlOut(ttlout.build()).build());
return actions;
}
- private List<Action> createDecMplsTtlAction() {
+ private static List<Action> createDecMplsTtlAction() {
DecMplsTtlBuilder mpls = new DecMplsTtlBuilder();
ActionBuilder action = new ActionBuilder();
action.setAction(new DecMplsTtlCaseBuilder().setDecMplsTtl(mpls.build()).build());
return actions;
}
- private List<Action> createGroupAction() {
+ private static List<Action> createGroupAction() {
GroupActionBuilder groupActionB = new GroupActionBuilder();
- groupActionB.setGroupId(1L);
+ groupActionB.setGroupId(Uint32.ONE);
groupActionB.setGroup("0");
ActionBuilder action = new ActionBuilder();
action.setAction(new GroupActionCaseBuilder().setGroupAction(groupActionB.build()).build());
ActionBuilder ab = new ActionBuilder();
GroupActionBuilder groupActionB = new GroupActionBuilder();
- groupActionB.setGroupId(1L);
+ groupActionB.setGroupId(Uint32.ONE);
groupActionB.setGroup("0");
ab.setAction(new GroupActionCaseBuilder().setGroupAction(groupActionB.build()).build());
import com.google.common.util.concurrent.FutureCallback;
import com.google.common.util.concurrent.MoreExecutors;
-import java.math.BigInteger;
import java.util.ArrayList;
import java.util.List;
import org.eclipse.osgi.framework.console.CommandInterpreter;
import org.opendaylight.mdsal.binding.api.DataBroker;
import org.opendaylight.mdsal.binding.api.NotificationService;
import org.opendaylight.mdsal.binding.api.ReadWriteTransaction;
+import org.opendaylight.mdsal.common.api.CommitInfo;
import org.opendaylight.mdsal.common.api.LogicalDatastoreType;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Prefix;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6FlowLabel;
import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.ethernet.match.fields.EthernetDestinationBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.ethernet.match.fields.EthernetSourceBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.ethernet.match.fields.EthernetTypeBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.ipv6.match.fields.Ipv6ExtHeaderBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.ipv6.match.fields.Ipv6LabelBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.EthernetMatchBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.Icmpv6MatchBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.Ipv6MatchBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.node.error.service.rev140410.NodeErrorListener;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.common.Uint16;
+import org.opendaylight.yangtools.yang.common.Uint32;
+import org.opendaylight.yangtools.yang.common.Uint64;
+import org.opendaylight.yangtools.yang.common.Uint8;
import org.osgi.framework.BundleContext;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
flow.setBarrier(Boolean.FALSE);
}
// flow.setBufferId(12L);
- BigInteger value = BigInteger.valueOf(10);
- BigInteger outputPort = BigInteger.valueOf(4294967295L);
- flow.setCookie(new FlowCookie(value));
- flow.setCookieMask(new FlowCookie(value));
- flow.setHardTimeout(0);
- flow.setIdleTimeout(0);
+ flow.setCookie(new FlowCookie(Uint64.TEN));
+ flow.setCookieMask(new FlowCookie(Uint64.TEN));
+ flow.setHardTimeout(Uint16.ZERO);
+ flow.setIdleTimeout(Uint16.ZERO);
flow.setInstallHw(false);
flow.setStrict(false);
flow.setContainerName(null);
flow.setFlags(new FlowModFlags(false, false, false, false, true));
flow.setId(new FlowId("12"));
flow.setTableId(getTableId(tableId));
- flow.setOutGroup(4294967295L);
+ flow.setOutGroup(Uint32.MAX_VALUE);
// set outport to OFPP_NONE (65535) to disable remove restriction for
// flow
- flow.setOutPort(outputPort);
+ flow.setOutPort(Uint64.valueOf(4294967295L));
FlowKey key = new FlowKey(new FlowId(Long.toString(id)));
flow.withKey(key);
- flow.setPriority(2);
+ flow.setPriority(Uint16.TWO);
flow.setFlowName(originalFlowName + "X" + flowType);
return flow;
}
- private short getTableId(String tableId) {
- short table = 2;
- if (tableId == null) {
- return table;
- }
-
- try {
- table = Short.parseShort(tableId);
- } catch (NumberFormatException ex) {
- // ignore exception and continue with default value
+ private static Uint8 getTableId(String tableId) {
+ if (tableId != null) {
+ try {
+ return Uint8.valueOf(tableId);
+ } catch (IllegalArgumentException ex) {
+ // ignore exception and continue with default value
+ }
}
-
- return table;
-
+ return Uint8.TWO;
}
public void _addFlows(CommandInterpreter ci) {
modification.delete(LogicalDatastoreType.OPERATIONAL, path4);
modification.delete(LogicalDatastoreType.CONFIGURATION, nodeBuilderToInstanceId(tn));
modification.delete(LogicalDatastoreType.CONFIGURATION, path4);
- modification.commit().addCallback(new FutureCallback<Object>() {
+ modification.commit().addCallback(new FutureCallback<CommitInfo>() {
@Override
- public void onSuccess(Object notUsed) {
+ public void onSuccess(CommitInfo notUsed) {
ci.println("Status of Group Data Loaded Transaction: success.");
}
modification.mergeParentStructureMerge(LogicalDatastoreType.CONFIGURATION, nodeBuilderToInstanceId(nodeBuilder),
nodeBuilder.build());
modification.mergeParentStructureMerge(LogicalDatastoreType.CONFIGURATION, path4, flow3.build());
- modification.commit().addCallback(new FutureCallback<Object>() {
+ modification.commit().addCallback(new FutureCallback<CommitInfo>() {
@Override
- public void onSuccess(Object notUsed) {
+ public void onSuccess(CommitInfo notUsed) {
ci.println("Status of Group Data Loaded Transaction: success.");
}
private static InstructionsBuilder createMeterInstructions() {
MeterBuilder aab = new MeterBuilder();
- aab.setMeterId(new MeterId(1L));
+ aab.setMeterId(new MeterId(Uint32.ONE));
InstructionBuilder ib = new InstructionBuilder();
ib.setInstruction(new MeterCaseBuilder().setMeter(aab.build()).build());
private static InstructionsBuilder createGotoTableInstructions() {
GoToTableBuilder aab = new GoToTableBuilder();
- aab.setTableId((short) 2);
+ aab.setTableId(Uint8.TWO);
InstructionBuilder ib = new InstructionBuilder();
ib.setInstruction(new GoToTableCaseBuilder().setGoToTable(aab.build()).build());
List<Action> actionList = new ArrayList<>();
ActionBuilder ab = new ActionBuilder();
ControllerActionBuilder controller = new ControllerActionBuilder();
- controller.setMaxLength(5);
+ controller.setMaxLength(Uint16.valueOf(5));
ab.setAction(new ControllerActionCaseBuilder().setControllerAction(controller.build()).build());
actionList.add(ab.build());
// Create an Apply Action
ActionBuilder ab = new ActionBuilder();
OutputActionBuilder output = new OutputActionBuilder();
- output.setMaxLength(0xffff);
+ output.setMaxLength(Uint16.MAX_VALUE);
Uri value = new Uri(OutputPortValues.CONTROLLER.toString());
output.setOutputNodeConnector(value);
ab.setAction(new OutputActionCaseBuilder().setOutputAction(output.build()).build());
ActionBuilder ab = new ActionBuilder();
PushMplsActionBuilder push = new PushMplsActionBuilder();
- push.setEthernetType(0x8847);
+ push.setEthernetType(Uint16.valueOf(0x8847));
ab.setAction(new PushMplsActionCaseBuilder().setPushMplsAction(push.build()).build());
actionList.add(ab.build());
// Create an Apply Action
ActionBuilder ab = new ActionBuilder();
PushPbbActionBuilder pbb = new PushPbbActionBuilder();
- pbb.setEthernetType(0x88E7);
+ pbb.setEthernetType(Uint16.valueOf(0x88E7));
ab.setAction(new PushPbbActionCaseBuilder().setPushPbbAction(pbb.build()).build());
actionList.add(ab.build());
// Create an Apply Action
ActionBuilder ab = new ActionBuilder();
SetVlanIdActionBuilder vl = new SetVlanIdActionBuilder();
- VlanId vlanId = new VlanId(4012);
+ VlanId vlanId = new VlanId(Uint16.valueOf(4012));
vl.setVlanId(vlanId);
ab.setAction(new SetVlanIdActionCaseBuilder().setSetVlanIdAction(vl.build()).build());
actionList.add(ab.build());
ActionBuilder ab = new ActionBuilder();
SetVlanPcpActionBuilder pcp = new SetVlanPcpActionBuilder();
- VlanPcp pcp1 = new VlanPcp((short) 2);
+ VlanPcp pcp1 = new VlanPcp(Uint8.TWO);
pcp.setVlanPcp(pcp1);
ab.setAction(new SetVlanPcpActionCaseBuilder().setSetVlanPcpAction(pcp.build()).build());
actionList.add(ab.build());
ActionBuilder ab = new ActionBuilder();
GroupActionBuilder groupActionB = new GroupActionBuilder();
- groupActionB.setGroupId(1L);
+ groupActionB.setGroupId(Uint32.ONE);
groupActionB.setGroup("0");
ab.setAction(new GroupActionCaseBuilder().setGroupAction(groupActionB.build()).build());
MatchBuilder match = new MatchBuilder();
EthernetMatchBuilder eth = new EthernetMatchBuilder();
EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
- ethTypeBuilder.setType(new EtherType(0x88ccL));
+ ethTypeBuilder.setType(new EtherType(Uint32.valueOf(0x88cc)));
eth.setEthernetType(ethTypeBuilder.build());
match.setEthernetMatch(eth.build());
return match;
EthernetMatchBuilder eth = new EthernetMatchBuilder();
EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
- ethTypeBuilder.setType(new EtherType(0x0800L));
+ ethTypeBuilder.setType(new EtherType(Uint32.valueOf(0x0800)));
eth.setEthernetType(ethTypeBuilder.build());
match.setEthernetMatch(eth.build());
return match;
EthernetMatchBuilder eth = new EthernetMatchBuilder();
EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
- ethTypeBuilder.setType(new EtherType(0x0800L));
+ ethTypeBuilder.setType(new EtherType(Uint32.valueOf(0x0800)));
eth.setEthernetType(ethTypeBuilder.build());
match.setEthernetMatch(eth.build());
return match;
EthernetMatchBuilder eth = new EthernetMatchBuilder();
EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
- ethTypeBuilder.setType(new EtherType(0x0800L));
+ ethTypeBuilder.setType(new EtherType(Uint32.valueOf(0x0800)));
eth.setEthernetType(ethTypeBuilder.build());
match.setEthernetMatch(eth.build());
return match;
EthernetMatchBuilder ethmatch = new EthernetMatchBuilder(); // ethernettype
// match
EthernetTypeBuilder ethtype = new EthernetTypeBuilder();
- EtherType type = new EtherType(0x0800L);
+ EtherType type = new EtherType(Uint32.valueOf(0x0800));
ethmatch.setEthernetType(ethtype.setType(type).build());
EthernetDestinationBuilder ethdest = new EthernetDestinationBuilder(); // ethernet
EthernetMatchBuilder eth = new EthernetMatchBuilder();
EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
- ethTypeBuilder.setType(new EtherType(0x86ddL));
+ ethTypeBuilder.setType(new EtherType(Uint32.valueOf(0x86dd)));
eth.setEthernetType(ethTypeBuilder.build());
match.setEthernetMatch(eth.build());
- Ipv6ExtHeaderBuilder nextheader = new Ipv6ExtHeaderBuilder();
- nextheader.setIpv6Exthdr(58);
Ipv6LabelBuilder ipv6label = new Ipv6LabelBuilder();
- Ipv6FlowLabel label = new Ipv6FlowLabel(10028L);
+ Ipv6FlowLabel label = new Ipv6FlowLabel(Uint32.valueOf(10028));
ipv6label.setIpv6Flabel(label);
// ipv6label.setFlabelMask(new byte[] { 0, 1, -1, -1 });
Icmpv6MatchBuilder icmpv6match = new Icmpv6MatchBuilder(); // icmpv6
// match
- icmpv6match.setIcmpv6Type((short) 135);
- icmpv6match.setIcmpv6Code((short) 0);
+ icmpv6match.setIcmpv6Type(Uint8.valueOf(135));
+ icmpv6match.setIcmpv6Code(Uint8.ZERO);
match.setIcmpv6Match(icmpv6match.build());
Ipv6MatchBuilder ipv6match = new Ipv6MatchBuilder();
MatchBuilder match = new MatchBuilder();
EthernetMatchBuilder eth = new EthernetMatchBuilder();
EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
- ethTypeBuilder.setType(new EtherType(0x86ddL));
+ ethTypeBuilder.setType(new EtherType(Uint32.valueOf(0x86dd)));
eth.setEthernetType(ethTypeBuilder.build());
match.setEthernetMatch(eth.build());
IpMatchBuilder ipmatch = new IpMatchBuilder(); // ipv4 version
- ipmatch.setIpProtocol((short) 58);
+ ipmatch.setIpProtocol(Uint8.valueOf(58));
match.setIpMatch(ipmatch.build());
Icmpv6MatchBuilder icmpv6match = new Icmpv6MatchBuilder(); // icmpv6
// match
- icmpv6match.setIcmpv6Type((short) 135);
- icmpv6match.setIcmpv6Code((short) 1);
+ icmpv6match.setIcmpv6Type(Uint8.valueOf(135));
+ icmpv6match.setIcmpv6Code(Uint8.ONE);
match.setIcmpv6Match(icmpv6match.build());
return match;
private static MatchBuilder createMetadataMatch() {
MatchBuilder match = new MatchBuilder();
MetadataBuilder metadata = new MetadataBuilder(); // metadata match
- metadata.setMetadata(BigInteger.valueOf(500L));
+ metadata.setMetadata(Uint64.valueOf(500));
// metadata.setMetadataMask(metamask);
match.setMetadata(metadata.build());
import org.eclipse.osgi.framework.console.CommandProvider;
import org.opendaylight.mdsal.binding.api.DataBroker;
import org.opendaylight.mdsal.binding.api.ReadWriteTransaction;
+import org.opendaylight.mdsal.common.api.CommitInfo;
import org.opendaylight.mdsal.common.api.LogicalDatastoreType;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Uri;
import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.CopyTtlInCaseBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeKey;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.common.Uint16;
+import org.opendaylight.yangtools.yang.common.Uint32;
+import org.opendaylight.yangtools.yang.common.Uint8;
import org.osgi.framework.BundleContext;
@SuppressWarnings("checkstyle:MethodName")
// Sample data , committing to DataStore
GroupBuilder group = new GroupBuilder();
- BucketBuilder bucket = new BucketBuilder();
- bucket.setBucketId(new BucketId((long) 12));
- bucket.withKey(new BucketKey(new BucketId((long) 12)));
+ BucketBuilder bucket = new BucketBuilder().withKey(new BucketKey(new BucketId(Uint32.valueOf(12))));
if (groupType == null) {
groupType = "g1";
bucket.setAction(createInportOutputAction());
break;
case "a24":
- bucket.setAction(Collections.EMPTY_LIST);
+ bucket.setAction(Collections.emptyList());
break;
case "a25":
bucket.setAction(createNonAppyOutputAction());
}
if ("add".equals(groupMod)) {
- bucket.setWatchGroup((long) 14);
- bucket.setWatchPort((long) 1234);
- bucket.setWeight(50);
+ bucket.setWatchGroup(Uint32.valueOf(14));
+ bucket.setWatchPort(Uint32.valueOf(1234));
+ bucket.setWeight(Uint16.valueOf(50));
} else {
- bucket.setWatchGroup((long) 13);
- bucket.setWatchPort((long) 134);
- bucket.setWeight(30);
+ bucket.setWatchGroup(Uint32.valueOf(13));
+ bucket.setWatchPort(Uint32.valueOf(134));
+ bucket.setWeight(Uint16.valueOf(30));
}
- long id = 1;
- GroupKey key = new GroupKey(new GroupId(id));
+ GroupKey key = new GroupKey(new GroupId(Uint32.ONE));
group.withKey(key);
// group.setInstall(false);
- group.setGroupId(new GroupId(id));
group.setGroupName(ORIGINAL_GROUP_NAME);
group.setBarrier(false);
BucketsBuilder value = new BucketsBuilder();
}
- private List<Action> createPopVlanAction() {
+ private static List<Action> createPopVlanAction() {
PopVlanActionBuilder vlanAction = new PopVlanActionBuilder();
ActionBuilder action = new ActionBuilder();
action.setAction(new PopVlanActionCaseBuilder().setPopVlanAction(vlanAction.build()).build());
return actions;
}
- private List<Action> createPushVlanAction() {
+ private static List<Action> createPushVlanAction() {
PushVlanActionBuilder vlan = new PushVlanActionBuilder();
- vlan.setEthernetType(0x8100);
+ vlan.setEthernetType(Uint16.valueOf(0x8100));
ActionBuilder action = new ActionBuilder();
action.setAction(new PushVlanActionCaseBuilder().setPushVlanAction(vlan.build()).build());
List<Action> actions = new ArrayList<>();
return actions;
}
- private List<Action> createPushMplsAction() {
+ private static List<Action> createPushMplsAction() {
PushMplsActionBuilder push = new PushMplsActionBuilder();
- push.setEthernetType(0x8847);
+ push.setEthernetType(Uint16.valueOf(0x8847));
ActionBuilder action = new ActionBuilder();
action.setAction(new PushMplsActionCaseBuilder().setPushMplsAction(push.build()).build());
List<Action> actions = new ArrayList<>();
return actions;
}
- private List<Action> createPopMplsAction() {
+ private static List<Action> createPopMplsAction() {
PopMplsActionBuilder popMplsActionBuilder = new PopMplsActionBuilder();
- popMplsActionBuilder.setEthernetType(0XB);
+ popMplsActionBuilder.setEthernetType(Uint16.valueOf(0XB));
ActionBuilder action = new ActionBuilder();
action.setAction(new PopMplsActionCaseBuilder().setPopMplsAction(popMplsActionBuilder.build()).build());
List<Action> actions = new ArrayList<>();
return actions;
}
- private List<Action> createPopPbbAction() {
+ private static List<Action> createPopPbbAction() {
PopPbbActionBuilder popPbbActionBuilder = new PopPbbActionBuilder();
ActionBuilder action = new ActionBuilder();
action.setAction(new PopPbbActionCaseBuilder().setPopPbbAction(popPbbActionBuilder.build()).build());
return actions;
}
- private List<Action> createPushPbbAction() {
+ private static List<Action> createPushPbbAction() {
PushPbbActionBuilder pbb = new PushPbbActionBuilder();
- pbb.setEthernetType(0x88E7);
+ pbb.setEthernetType(Uint16.valueOf(0x88E7));
ActionBuilder action = new ActionBuilder();
action.setAction(new PushPbbActionCaseBuilder().setPushPbbAction(pbb.build()).build());
List<Action> actions = new ArrayList<>();
return actions;
}
- private List<Action> createSetMplsTtlAction() {
+ private static List<Action> createSetMplsTtlAction() {
SetMplsTtlActionBuilder setMplsTtlActionBuilder = new SetMplsTtlActionBuilder();
- setMplsTtlActionBuilder.setMplsTtl((short) 0X1);
+ setMplsTtlActionBuilder.setMplsTtl(Uint8.ONE);
ActionBuilder action = new ActionBuilder();
action.setAction(new SetMplsTtlActionCaseBuilder().setSetMplsTtlAction(
setMplsTtlActionBuilder.build()).build());
return actions;
}
- private List<Action> createSetNwTtlAction() {
+ private static List<Action> createSetNwTtlAction() {
SetNwTtlActionBuilder setNwTtlActionBuilder = new SetNwTtlActionBuilder();
- setNwTtlActionBuilder.setNwTtl((short) 1);
+ setNwTtlActionBuilder.setNwTtl(Uint8.ONE);
ActionBuilder action = new ActionBuilder();
action.setAction(new SetNwTtlActionCaseBuilder().setSetNwTtlAction(setNwTtlActionBuilder.build()).build());
List<Action> actions = new ArrayList<>();
return actions;
}
- private List<Action> createSetQueueAction() {
+ private static List<Action> createSetQueueAction() {
SetQueueActionBuilder setQueueActionBuilder = new SetQueueActionBuilder();
- setQueueActionBuilder.setQueueId(1L);
+ setQueueActionBuilder.setQueueId(Uint32.ONE);
ActionBuilder action = new ActionBuilder();
action.setAction(new SetQueueActionCaseBuilder().setSetQueueAction(setQueueActionBuilder.build()).build());
action.withKey(new ActionKey(0));
}
- private List<Action> createCopyTtlInAction() {
+ private static List<Action> createCopyTtlInAction() {
CopyTtlInBuilder ttlin = new CopyTtlInBuilder();
ActionBuilder action = new ActionBuilder();
action.setAction(new CopyTtlInCaseBuilder().setCopyTtlIn(ttlin.build()).build());
return actions;
}
- private List<Action> createCopyTtlOutAction() {
+ private static List<Action> createCopyTtlOutAction() {
CopyTtlOutBuilder ttlout = new CopyTtlOutBuilder();
ActionBuilder action = new ActionBuilder();
action.setAction(new CopyTtlOutCaseBuilder().setCopyTtlOut(ttlout.build()).build());
return actions;
}
- private List<Action> createDecMplsTtlAction() {
+ private static List<Action> createDecMplsTtlAction() {
DecMplsTtlBuilder mpls = new DecMplsTtlBuilder();
ActionBuilder action = new ActionBuilder();
action.setAction(new DecMplsTtlCaseBuilder().setDecMplsTtl(mpls.build()).build());
return actions;
}
- private List<Action> createDecNwTtlAction() {
+ private static List<Action> createDecNwTtlAction() {
DecNwTtlBuilder nwttl = new DecNwTtlBuilder();
ActionBuilder action = new ActionBuilder();
action.setAction(new DecNwTtlCaseBuilder().setDecNwTtl(nwttl.build()).build());
return actions;
}
- private List<Action> createFloodOutputAction() {
+ private static List<Action> createFloodOutputAction() {
ActionBuilder ab = new ActionBuilder();
OutputActionBuilder output = new OutputActionBuilder();
- output.setMaxLength(30);
+ output.setMaxLength(Uint16.valueOf(30));
Uri value = new Uri(OutputPortValues.FLOOD.toString());
output.setOutputNodeConnector(value);
ab.setAction(new OutputActionCaseBuilder().setOutputAction(output.build()).build());
return actions;
}
- private List<Action> createAllOutputAction() {
+ private static List<Action> createAllOutputAction() {
ActionBuilder ab = new ActionBuilder();
OutputActionBuilder output = new OutputActionBuilder();
- output.setMaxLength(30);
+ output.setMaxLength(Uint16.valueOf(30));
Uri value = new Uri(OutputPortValues.ALL.toString());
output.setOutputNodeConnector(value);
ab.setAction(new OutputActionCaseBuilder().setOutputAction(output.build()).build());
return actions;
}
- private List<Action> createAnyOutputAction() {
+ private static List<Action> createAnyOutputAction() {
ActionBuilder ab = new ActionBuilder();
OutputActionBuilder output = new OutputActionBuilder();
- output.setMaxLength(30);
+ output.setMaxLength(Uint16.valueOf(30));
Uri value = new Uri(OutputPortValues.ANY.toString());
output.setOutputNodeConnector(value);
ab.setAction(new OutputActionCaseBuilder().setOutputAction(output.build()).build());
return actions;
}
- private List<Action> createNormalOutputAction() {
+ private static List<Action> createNormalOutputAction() {
ActionBuilder ab = new ActionBuilder();
OutputActionBuilder output = new OutputActionBuilder();
- output.setMaxLength(30);
+ output.setMaxLength(Uint16.valueOf(30));
Uri value = new Uri(OutputPortValues.NORMAL.toString());
output.setOutputNodeConnector(value);
ab.setAction(new OutputActionCaseBuilder().setOutputAction(output.build()).build());
return actions;
}
- private List<Action> createInportOutputAction() {
+ private static List<Action> createInportOutputAction() {
ActionBuilder ab = new ActionBuilder();
OutputActionBuilder output = new OutputActionBuilder();
- output.setMaxLength(30);
+ output.setMaxLength(Uint16.valueOf(30));
Uri value = new Uri(OutputPortValues.INPORT.toString());
output.setOutputNodeConnector(value);
ab.setAction(new OutputActionCaseBuilder().setOutputAction(output.build()).build());
return actions;
}
- private List<Action> creatTableOutputAction() {
+ private static List<Action> creatTableOutputAction() {
ActionBuilder ab = new ActionBuilder();
OutputActionBuilder output = new OutputActionBuilder();
- output.setMaxLength(30);
+ output.setMaxLength(Uint16.valueOf(30));
Uri value = new Uri(OutputPortValues.TABLE.toString());
output.setOutputNodeConnector(value);
ab.setAction(new OutputActionCaseBuilder().setOutputAction(output.build()).build());
return actions;
}
- private List<Action> createControllerAction() {
+ private static List<Action> createControllerAction() {
ActionBuilder ab = new ActionBuilder();
OutputActionBuilder output = new OutputActionBuilder();
- output.setMaxLength(30);
+ output.setMaxLength(Uint16.valueOf(30));
Uri value = new Uri(OutputPortValues.CONTROLLER.toString());
output.setOutputNodeConnector(value);
ab.setAction(new OutputActionCaseBuilder().setOutputAction(output.build()).build());
return actions;
}
- private List<Action> createLocalOutputAction() {
+ private static List<Action> createLocalOutputAction() {
ActionBuilder ab = new ActionBuilder();
OutputActionBuilder output = new OutputActionBuilder();
- output.setMaxLength(30);
+ output.setMaxLength(Uint16.valueOf(30));
Uri value = new Uri(OutputPortValues.LOCAL.toString());
output.setOutputNodeConnector(value);
ab.setAction(new OutputActionCaseBuilder().setOutputAction(output.build()).build());
return actions;
}
- private List<Action> createGroupAction() {
+ private static List<Action> createGroupAction() {
GroupActionBuilder groupActionB = new GroupActionBuilder();
- groupActionB.setGroupId(1L);
+ groupActionB.setGroupId(Uint32.ONE);
groupActionB.setGroup("0");
ActionBuilder action = new ActionBuilder();
action.setAction(new GroupActionCaseBuilder().setGroupAction(groupActionB.build()).build());
Uri value = new Uri(OutputPortValues.CONTROLLER.toString());
output.setOutputNodeConnector(value);
//output.setMaxLength(null);
- output.setMaxLength(66000);
+ output.setMaxLength(Uint16.valueOf(66000));
ab.setAction(new OutputActionCaseBuilder().setOutputAction(output.build()).build());
List<Action> actionList = new ArrayList<>();
}
private static List<Action> createNonAppyPushMplsAction() {
-
List<Action> actionList = new ArrayList<>();
ActionBuilder ab = new ActionBuilder();
PushMplsActionBuilder push = new PushMplsActionBuilder();
- push.setEthernetType(0x8849);
+ push.setEthernetType(Uint16.valueOf(0x8849));
ab.setAction(new PushMplsActionCaseBuilder().setPushMplsAction(push.build()).build());
actionList.add(ab.build());
return actionList;
}
private static List<Action> createNonAppyPushPbbAction() {
-
List<Action> actionList = new ArrayList<>();
ActionBuilder ab = new ActionBuilder();
PushPbbActionBuilder pbb = new PushPbbActionBuilder();
- pbb.setEthernetType(0x88E8);
+ pbb.setEthernetType(Uint16.valueOf(0x88E8));
ab.setAction(new PushPbbActionCaseBuilder().setPushPbbAction(pbb.build()).build());
actionList.add(ab.build());
return actionList;
-
}
-
private static List<Action> createNonAppyPushVlanAction() {
-
List<Action> actionList = new ArrayList<>();
ActionBuilder ab = new ActionBuilder();
PushVlanActionBuilder vlan = new PushVlanActionBuilder();
- vlan.setEthernetType(0x8101);
+ vlan.setEthernetType(Uint16.valueOf(0x8101));
ab.setAction(new PushVlanActionCaseBuilder().setPushVlanAction(vlan.build()).build());
actionList.add(ab.build());
return actionList;
InstanceIdentifier<Group> path1 = InstanceIdentifier.create(Nodes.class).child(Node.class, testNode.key())
.augmentation(FlowCapableNode.class).child(Group.class, new GroupKey(gbuilder.getGroupId()));
modification.delete(LogicalDatastoreType.CONFIGURATION, path1);
- modification.commit().addCallback(new FutureCallback<Object>() {
+ modification.commit().addCallback(new FutureCallback<CommitInfo>() {
@Override
- public void onSuccess(Object notUsed) {
+ public void onSuccess(CommitInfo notUsed) {
ci.println("Status of Group Data Loaded Transaction: success.");
}
modification.mergeParentStructureMerge(LogicalDatastoreType.CONFIGURATION, nodeToInstanceId(testNode),
testNode);
modification.mergeParentStructureMerge(LogicalDatastoreType.CONFIGURATION, path1, group);
- modification.commit().addCallback(new FutureCallback<Object>() {
+ modification.commit().addCallback(new FutureCallback<CommitInfo>() {
@Override
- public void onSuccess(Object notUsed) {
+ public void onSuccess(CommitInfo notUsed) {
ci.println("Status of Group Data Loaded Transaction: success.");
}
import org.opendaylight.mdsal.binding.api.DataBroker;
import org.opendaylight.mdsal.binding.api.NotificationService;
import org.opendaylight.mdsal.binding.api.ReadWriteTransaction;
+import org.opendaylight.mdsal.common.api.CommitInfo;
import org.opendaylight.mdsal.common.api.LogicalDatastoreType;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNode;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.meters.Meter;
import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.meter.meter.band.headers.meter.band.header.MeterBandTypesBuilder;
import org.opendaylight.yangtools.concepts.Registration;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.common.Uint32;
+import org.opendaylight.yangtools.yang.common.Uint8;
import org.osgi.framework.BundleContext;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
private MeterBuilder createTestMeter() {
// Sample data , committing to DataStore
- long id = 12;
- MeterKey key = new MeterKey(new MeterId(id));
+ MeterKey key = new MeterKey(new MeterId(Uint32.valueOf(12)));
MeterBuilder meter = new MeterBuilder();
meter.setContainerName("abcd");
meter.withKey(key);
- meter.setMeterId(new MeterId(9L));
+ meter.setMeterId(new MeterId(Uint32.valueOf(9)));
meter.setMeterName(originalMeterName);
meter.setFlags(new MeterFlags(true, false, false, false));
MeterBandHeaderBuilder bandHeader = new MeterBandHeaderBuilder();
- bandHeader.setBandRate((long) 234);
- bandHeader.setBandBurstSize((long) 444);
+ bandHeader.setBandRate(Uint32.valueOf(234));
+ bandHeader.setBandBurstSize(Uint32.valueOf(444));
DscpRemarkBuilder dscpRemark = new DscpRemarkBuilder();
- dscpRemark.setDscpRemarkBurstSize((long) 5);
- dscpRemark.setPrecLevel((short) 1);
- dscpRemark.setDscpRemarkRate((long) 12);
+ dscpRemark.setDscpRemarkBurstSize(Uint32.valueOf(5));
+ dscpRemark.setPrecLevel(Uint8.ONE);
+ dscpRemark.setDscpRemarkRate(Uint32.valueOf(12));
bandHeader.setBandType(dscpRemark.build());
MeterBandTypesBuilder bandTypes = new MeterBandTypesBuilder();
MeterBandType bandType = new MeterBandType(false, true, false);
bandTypes.setFlags(bandType);
bandHeader.setMeterBandTypes(bandTypes.build());
- bandHeader.setBandId(new BandId(0L));
+ bandHeader.setBandId(new BandId(Uint32.ZERO));
List<MeterBandHeader> bandHdr = new ArrayList<>();
bandHdr.add(bandHeader.build());
private MeterBuilder createTestMeters(String s1, String s2) {
// Sample data , committing to DataStore
- long id = Integer.parseInt(s1);
- MeterKey key = new MeterKey(new MeterId(id));
+ MeterKey key = new MeterKey(new MeterId(Uint32.valueOf(s1)));
MeterBuilder meter = new MeterBuilder();
meter.setContainerName("abcd");
meter.withKey(key);
- meter.setMeterId(new MeterId(9L));
+ meter.setMeterId(new MeterId(Uint32.valueOf(9)));
MeterBandHeaderBuilder bandHeader = new MeterBandHeaderBuilder();
if (s2.equalsIgnoreCase("modify")) {
meter.setMeterName(updatedMeterName);
- bandHeader.setBandRate((long) 234);
+ bandHeader.setBandRate(Uint32.valueOf(234));
} else {
meter.setMeterName(originalMeterName);
- bandHeader.setBandRate((long) 123);
+ bandHeader.setBandRate(Uint32.valueOf(123));
}
meter.setFlags(new MeterFlags(true, false, false, false));
- bandHeader.setBandBurstSize((long) 444);
+ bandHeader.setBandBurstSize(Uint32.valueOf(444));
DscpRemarkBuilder dscpRemark = new DscpRemarkBuilder();
- dscpRemark.setDscpRemarkBurstSize((long) 5);
- dscpRemark.setPrecLevel((short) 1);
- dscpRemark.setDscpRemarkRate((long) 12);
+ dscpRemark.setDscpRemarkBurstSize(Uint32.valueOf(5));
+ dscpRemark.setPrecLevel(Uint8.ONE);
+ dscpRemark.setDscpRemarkRate(Uint32.valueOf(12));
bandHeader.setBandType(dscpRemark.build());
MeterBandTypesBuilder bandTypes = new MeterBandTypesBuilder();
MeterBandType bandType = new MeterBandType(false, true, false);
bandTypes.setFlags(bandType);
bandHeader.setMeterBandTypes(bandTypes.build());
- bandHeader.setBandId(new BandId(0L));
+ bandHeader.setBandId(new BandId(Uint32.ZERO));
List<MeterBandHeader> bandHdr = new ArrayList<>();
bandHdr.add(bandHeader.build());
InstanceIdentifier<Meter> path1 = InstanceIdentifier.create(Nodes.class).child(Node.class, testNode.key())
.augmentation(FlowCapableNode.class).child(Meter.class, new MeterKey(testMeter.getMeterId()));
modification.delete(LogicalDatastoreType.CONFIGURATION, path1);
- modification.commit().addCallback(new FutureCallback<Object>() {
+ modification.commit().addCallback(new FutureCallback<CommitInfo>() {
@Override
- public void onSuccess(Object notUsed) {
+ public void onSuccess(CommitInfo notUsed) {
ci.println("Status of Group Data Loaded Transaction: success.");
}
break;
}
- modification.commit().addCallback(new FutureCallback<Object>() {
+ modification.commit().addCallback(new FutureCallback<CommitInfo>() {
@Override
- public void onSuccess(Object notUsed) {
+ public void onSuccess(CommitInfo notUsed) {
ci.println("Status of Group Data Loaded Transaction: success.");
}
modification.mergeParentStructureMerge(LogicalDatastoreType.CONFIGURATION, nodeToInstanceId(testNode),
testNode);
modification.mergeParentStructureMerge(LogicalDatastoreType.CONFIGURATION, path1, meter);
- modification.commit().addCallback(new FutureCallback<Object>() {
+ modification.commit().addCallback(new FutureCallback<CommitInfo>() {
@Override
- public void onSuccess(Object notUsed) {
+ public void onSuccess(CommitInfo notUsed) {
ci.println("Status of Group Data Loaded Transaction: success.");
}
testNode);
modification.mergeParentStructureMerge(LogicalDatastoreType.CONFIGURATION, path2, meter1);
- modification.commit().addCallback(new FutureCallback<Object>() {
+ modification.commit().addCallback(new FutureCallback<CommitInfo>() {
@Override
- public void onSuccess(Object notUsed) {
+ public void onSuccess(CommitInfo notUsed) {
ci.println("Status of Group Data Loaded Transaction: success.");
}
import com.google.common.base.Preconditions;
import com.google.common.util.concurrent.FutureCallback;
import com.google.common.util.concurrent.MoreExecutors;
-import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import org.eclipse.osgi.framework.console.CommandProvider;
import org.opendaylight.mdsal.binding.api.DataBroker;
import org.opendaylight.mdsal.binding.api.ReadWriteTransaction;
+import org.opendaylight.mdsal.common.api.CommitInfo;
import org.opendaylight.mdsal.common.api.LogicalDatastoreType;
import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.CopyTtlInCaseBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.CopyTtlOutCaseBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.features.table.features.table.properties.TableFeaturePropertiesKey;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
import org.opendaylight.yangtools.yang.binding.KeyedInstanceIdentifier;
+import org.opendaylight.yangtools.yang.common.Uint32;
+import org.opendaylight.yangtools.yang.common.Uint64;
import org.opendaylight.yangtools.yang.common.Uint8;
import org.osgi.framework.BundleContext;
if (!tableFeatureType.equals("t1")) {
- tableFeature.setTableId((short) 0);
+ tableFeature.setTableId(Uint8.ZERO);
tableFeature.setName("Table 0");
- tableFeature.setMetadataMatch(BigInteger.valueOf(10));
- tableFeature.setMetadataWrite(BigInteger.valueOf(10));
- tableFeature.setMaxEntries(10000L);
+ tableFeature.setMetadataMatch(Uint64.TEN);
+ tableFeature.setMetadataWrite(Uint64.TEN);
+ tableFeature.setMaxEntries(Uint32.valueOf(10000));
tableFeature.setConfig(new TableConfig(false));
modification.mergeParentStructureMerge(LogicalDatastoreType.CONFIGURATION, nodeToInstanceId(testNode),
testNode);
modification.mergeParentStructureMerge(LogicalDatastoreType.CONFIGURATION, path1, tableFeatures);
- modification.commit().addCallback(new FutureCallback<Object>() {
+ modification.commit().addCallback(new FutureCallback<CommitInfo>() {
@Override
- public void onSuccess(Object notUsed) {
+ public void onSuccess(CommitInfo notUsed) {
ci.println("Status of Group Data Loaded Transaction: success.");
}
import com.google.common.util.concurrent.FutureCallback;
import com.google.common.util.concurrent.MoreExecutors;
-import java.math.BigInteger;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.ExecutorService;
import org.opendaylight.mdsal.binding.api.DataBroker;
import org.opendaylight.mdsal.binding.api.NotificationService;
import org.opendaylight.mdsal.binding.api.ReadWriteTransaction;
+import org.opendaylight.mdsal.common.api.CommitInfo;
import org.opendaylight.mdsal.common.api.LogicalDatastoreType;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Dscp;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Prefix;
import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.vlan.match.fields.VlanIdBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.node.error.service.rev140410.NodeErrorListener;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.common.Uint16;
+import org.opendaylight.yangtools.yang.common.Uint32;
+import org.opendaylight.yangtools.yang.common.Uint64;
+import org.opendaylight.yangtools.yang.common.Uint8;
import org.osgi.framework.BundleContext;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
createTestFlow(createTestNode(null), null, null);
}
- private NodeBuilder createTestNode(final String nodeId) {
+ private static NodeBuilder createTestNode(final String nodeId) {
String localNodeId;
if (nodeId == null) {
return builder;
}
- private InstanceIdentifier<Node> nodeBuilderToInstanceId(final NodeBuilder node) {
+ private static InstanceIdentifier<Node> nodeBuilderToInstanceId(final NodeBuilder node) {
return InstanceIdentifier.create(Nodes.class).child(Node.class, node.key());
}
- private FlowBuilder createTestFlow(final NodeBuilder nodeBuilder, final String flowTypeArg, final String tableId) {
+ private static FlowBuilder createTestFlow(final NodeBuilder nodeBuilder, final String flowTypeArg,
+ final String tableId) {
final long TEST_ID = 123;
final FlowBuilder flow = new FlowBuilder();
flowType = "f1";
}
- flow.setPriority(2);
+ flow.setPriority(Uint16.TWO);
switch (flowType) {
case "f1":
id += 54;
flow.setMatch(new MatchBuilder().build());
flow.setInstructions(createSentToControllerInstructions().build());
- flow.setPriority(0);
+ flow.setPriority(Uint16.ZERO);
break;
case "f55":
id += 55;
case "f56":
id += 56;
flow.setMatch(createToSMatch().build());
- flow.setInstructions(createOutputInstructions("INPORT", 10).build());
+ flow.setInstructions(createOutputInstructions("INPORT", Uint16.TEN).build());
break;
case "f57":
id += 57;
flow.setMatch(createToSMatch().build());
- flow.setInstructions(createOutputInstructions("FLOOD", 20).build());
+ flow.setInstructions(createOutputInstructions("FLOOD", Uint16.valueOf(20)).build());
break;
case "f58":
id += 58;
flow.setMatch(createToSMatch().build());
- flow.setInstructions(createOutputInstructions("ALL", 30).build());
+ flow.setInstructions(createOutputInstructions("ALL", Uint16.valueOf(30)).build());
break;
case "f59":
id += 59;
flow.setMatch(createToSMatch().build());
- flow.setInstructions(createOutputInstructions("NORMAL", 40).build());
+ flow.setInstructions(createOutputInstructions("NORMAL", Uint16.valueOf(40)).build());
break;
case "f60":
id += 60;
flow.setMatch(createToSMatch().build());
- flow.setInstructions(createOutputInstructions("LOCAL", 50).build());
+ flow.setInstructions(createOutputInstructions("LOCAL", Uint16.valueOf(50)).build());
break;
case "f61":
id += 61;
flow.setMatch(createToSMatch().build());
- flow.setInstructions(createOutputInstructions("TABLE", 60).build());
+ flow.setInstructions(createOutputInstructions("TABLE", Uint16.valueOf(60)).build());
break;
case "f62":
id += 62;
flow.setMatch(createToSMatch().build());
- flow.setInstructions(createOutputInstructions("NONE", 70).build());
+ flow.setInstructions(createOutputInstructions("NONE", Uint16.valueOf(70)).build());
break;
case "f63":
id += 63;
if (null == flow.isBarrier()) {
flow.setBarrier(Boolean.FALSE);
}
- final BigInteger value = BigInteger.valueOf(10);
- flow.setCookie(new FlowCookie(value));
- flow.setCookieMask(new FlowCookie(value));
- flow.setHardTimeout(0);
- flow.setIdleTimeout(0);
+ flow.setCookie(new FlowCookie(Uint64.TEN));
+ flow.setCookieMask(new FlowCookie(Uint64.TEN));
+ flow.setHardTimeout(Uint16.ZERO);
+ flow.setIdleTimeout(Uint16.ZERO);
flow.setInstallHw(false);
flow.setStrict(false);
flow.setContainerName(null);
}
- private FlowBuilder createTestFlowPerfTest(final String flowTypeArg, final String tableId, final int id) {
+ private static FlowBuilder createTestFlowPerfTest(final String flowTypeArg, final String tableId, final int id) {
final FlowBuilder flow = new FlowBuilder();
String flowType = flowTypeArg;
int flowId = id;
flowType = "f1";
}
- flow.setPriority(flowId);
+ flow.setPriority(Uint16.valueOf(flowId));
switch (flowType) {
case "f1":
if (null == flow.isBarrier()) {
flow.setBarrier(Boolean.FALSE);
}
- final BigInteger value = BigInteger.valueOf(10);
- flow.setCookie(new FlowCookie(value));
- flow.setCookieMask(new FlowCookie(value));
- flow.setHardTimeout(0);
- flow.setIdleTimeout(0);
+ flow.setCookie(new FlowCookie(Uint64.TEN));
+ flow.setCookieMask(new FlowCookie(Uint64.TEN));
+ flow.setHardTimeout(Uint16.ZERO);
+ flow.setIdleTimeout(Uint16.ZERO);
flow.setInstallHw(false);
flow.setStrict(false);
flow.setContainerName(null);
return flow;
}
- private FlowBuilder createtablemiss() {
+ private static FlowBuilder createtablemiss() {
final FlowBuilder flow = new FlowBuilder();
final long id = 456;
final MatchBuilder matchBuilder = new MatchBuilder();
flow.setMatch(matchBuilder.build());
flow.setInstructions(createSentToControllerInstructions().build());
- flow.setPriority(0);
- flow.setTableId((short) 0);
+ flow.setPriority(Uint16.ZERO);
+ flow.setTableId(Uint8.ZERO);
final FlowKey key = new FlowKey(new FlowId(Long.toString(id)));
flow.withKey(key);
return flow;
}
- private short getTableId(final String tableId) {
- final short TABLE_ID = 2;
- short table = TABLE_ID;
+ private static Uint8 getTableId(final String tableId) {
+ Uint8 table = Uint8.TWO;
if (tableId == null) {
return table;
}
try {
- table = Short.parseShort(tableId);
+ table = Uint8.valueOf(tableId);
} catch (NumberFormatException ex) {
LOG.info("Parsing String tableId {} failed. Continuing with default tableId {}.",
tableId, table);
private static InstructionsBuilder createMeterInstructions() {
final MeterBuilder aab = new MeterBuilder();
- aab.setMeterId(new MeterId(1L));
+ aab.setMeterId(new MeterId(Uint32.ONE));
final InstructionBuilder ib = new InstructionBuilder();
ib.setInstruction(new MeterCaseBuilder().setMeter(aab.build()).build());
private static InstructionsBuilder createMetadataInstructions() {
final WriteMetadataBuilder aab = new WriteMetadataBuilder();
- aab.setMetadata(BigInteger.valueOf(10));
- aab.setMetadataMask(BigInteger.valueOf(10));
+ aab.setMetadata(Uint64.valueOf(10));
+ aab.setMetadataMask(Uint64.valueOf(10));
final InstructionBuilder ib = new InstructionBuilder();
ib.setInstruction(new WriteMetadataCaseBuilder().setWriteMetadata(aab.build()).build());
private static InstructionsBuilder createGotoTableInstructions() {
final GoToTableBuilder aab = new GoToTableBuilder();
- aab.setTableId((short) 5);
+ aab.setTableId(Uint8.valueOf(5));
final InstructionBuilder ib = new InstructionBuilder();
ib.setInstruction(new GoToTableCaseBuilder().setGoToTable(aab.build()).build());
final List<Action> actionList = new ArrayList<>();
final ActionBuilder ab = new ActionBuilder();
final ControllerActionBuilder controller = new ControllerActionBuilder();
- controller.setMaxLength(5);
+ controller.setMaxLength(Uint16.valueOf(5));
ab.setAction(new ControllerActionCaseBuilder().setControllerAction(controller.build()).build());
ab.withKey(new ActionKey(0));
actionList.add(ab.build());
final ActionBuilder ab = new ActionBuilder();
final OutputActionBuilder output = new OutputActionBuilder();
- output.setMaxLength(56);
+ output.setMaxLength(Uint16.valueOf(56));
final Uri value = new Uri("PCEP");
output.setOutputNodeConnector(value);
ab.setAction(new OutputActionCaseBuilder().setOutputAction(output.build()).build());
return isb;
}
- private static InstructionsBuilder createOutputInstructions(final String outputType, final int outputValue) {
+ private static InstructionsBuilder createOutputInstructions(final String outputType, final Uint16 outputValue) {
final List<Action> actionList = new ArrayList<>();
final ActionBuilder ab = new ActionBuilder();
final ActionBuilder ab = new ActionBuilder();
final OutputActionBuilder output = new OutputActionBuilder();
- output.setMaxLength(Integer.valueOf(0xffff));
+ output.setMaxLength(Uint16.MAX_VALUE);
final Uri value = new Uri(OutputPortValues.CONTROLLER.toString());
output.setOutputNodeConnector(value);
ab.setAction(new OutputActionCaseBuilder().setOutputAction(output.build()).build());
final ActionBuilder ab = new ActionBuilder();
final PushMplsActionBuilder push = new PushMplsActionBuilder();
- push.setEthernetType(Integer.valueOf(0x8847));
+ push.setEthernetType(Uint16.valueOf(0x8847));
ab.setAction(new PushMplsActionCaseBuilder().setPushMplsAction(push.build()).build());
ab.withKey(new ActionKey(0));
actionList.add(ab.build());
final ActionBuilder ab = new ActionBuilder();
final PushPbbActionBuilder pbb = new PushPbbActionBuilder();
- pbb.setEthernetType(Integer.valueOf(0x88E7));
+ pbb.setEthernetType(Uint16.valueOf(0x88E7));
ab.setAction(new PushPbbActionCaseBuilder().setPushPbbAction(pbb.build()).build());
ab.withKey(new ActionKey(0));
actionList.add(ab.build());
final ActionBuilder ab = new ActionBuilder();
final PushVlanActionBuilder vlan = new PushVlanActionBuilder();
- vlan.setEthernetType(Integer.valueOf(0x8100));
+ vlan.setEthernetType(Uint16.valueOf(0x8100));
ab.setAction(new PushVlanActionCaseBuilder().setPushVlanAction(vlan.build()).build());
ab.withKey(new ActionKey(0));
actionList.add(ab.build());
final ActionBuilder ab = new ActionBuilder();
final SetVlanIdActionBuilder vl = new SetVlanIdActionBuilder();
- final VlanId a = new VlanId(4000);
+ final VlanId a = new VlanId(Uint16.valueOf(4000));
vl.setVlanId(a);
ab.setAction(new SetVlanIdActionCaseBuilder().setSetVlanIdAction(vl.build()).build());
ab.withKey(new ActionKey(0));
final ActionBuilder ab = new ActionBuilder();
final SetVlanPcpActionBuilder pcp = new SetVlanPcpActionBuilder();
- final VlanPcp pcp1 = new VlanPcp((short) 2);
+ final VlanPcp pcp1 = new VlanPcp(Uint8.TWO);
pcp.setVlanPcp(pcp1);
ab.setAction(new SetVlanPcpActionCaseBuilder().setSetVlanPcpAction(pcp.build()).build());
ab.withKey(new ActionKey(0));
final SetVlanPcpActionBuilder pcp = new SetVlanPcpActionBuilder();
// the code point is a 3-bit(0-7) field representing the frame priority level
- final VlanPcp pcp1 = new VlanPcp((short) 4);
+ final VlanPcp pcp1 = new VlanPcp(Uint8.valueOf(4));
pcp.setVlanPcp(pcp1);
ab.setAction(new SetVlanPcpActionCaseBuilder().setSetVlanPcpAction(pcp.build()).build());
ab.withKey(new ActionKey(0));
final ActionBuilder ab = new ActionBuilder();
final GroupActionBuilder groupActionB = new GroupActionBuilder();
- groupActionB.setGroupId(1L);
+ groupActionB.setGroupId(Uint32.ONE);
groupActionB.setGroup("0");
ab.setAction(new GroupActionCaseBuilder().setGroupAction(groupActionB.build()).build());
ab.withKey(new ActionKey(0));
final ActionBuilder ab = new ActionBuilder();
final PopMplsActionBuilder popMplsActionBuilder = new PopMplsActionBuilder();
- popMplsActionBuilder.setEthernetType(0XB);
+ popMplsActionBuilder.setEthernetType(Uint16.valueOf(0xB));
ab.setAction(new PopMplsActionCaseBuilder().setPopMplsAction(popMplsActionBuilder.build()).build());
ab.withKey(new ActionKey(0));
actionList.add(ab.build());
final ActionBuilder ab = new ActionBuilder();
final SetDlTypeActionBuilder setDlTypeActionBuilder = new SetDlTypeActionBuilder();
- setDlTypeActionBuilder.setDlType(new EtherType(8L));
+ setDlTypeActionBuilder.setDlType(new EtherType(Uint32.valueOf(8)));
ab.setAction(new SetDlTypeActionCaseBuilder().setSetDlTypeAction(setDlTypeActionBuilder.build()).build());
ab.withKey(new ActionKey(0));
actionList.add(ab.build());
final ActionBuilder ab = new ActionBuilder();
final SetMplsTtlActionBuilder setMplsTtlActionBuilder = new SetMplsTtlActionBuilder();
- setMplsTtlActionBuilder.setMplsTtl((short) 0X1);
+ setMplsTtlActionBuilder.setMplsTtl(Uint8.ONE);
ab.setAction(new SetMplsTtlActionCaseBuilder().setSetMplsTtlAction(setMplsTtlActionBuilder.build()).build());
ab.withKey(new ActionKey(0));
actionList.add(ab.build());
final ActionBuilder ab = new ActionBuilder();
final SetNwTtlActionBuilder setNwTtlActionBuilder = new SetNwTtlActionBuilder();
- setNwTtlActionBuilder.setNwTtl((short) 1);
+ setNwTtlActionBuilder.setNwTtl(Uint8.ONE);
ab.setAction(new SetNwTtlActionCaseBuilder().setSetNwTtlAction(setNwTtlActionBuilder.build()).build());
ab.withKey(new ActionKey(0));
actionList.add(ab.build());
final ActionBuilder ab = new ActionBuilder();
final SetQueueActionBuilder setQueueActionBuilder = new SetQueueActionBuilder();
- setQueueActionBuilder.setQueueId(1L);
+ setQueueActionBuilder.setQueueId(Uint32.ONE);
ab.setAction(new SetQueueActionCaseBuilder().setSetQueueAction(setQueueActionBuilder.build()).build());
ab.withKey(new ActionKey(0));
actionList.add(ab.build());
final ActionBuilder ab = new ActionBuilder();
final SetTpDstActionBuilder setTpDstActionBuilder = new SetTpDstActionBuilder();
- setTpDstActionBuilder.setPort(new PortNumber(109));
+ setTpDstActionBuilder.setPort(new PortNumber(Uint16.valueOf(109)));
ab.setAction(new SetTpDstActionCaseBuilder().setSetTpDstAction(setTpDstActionBuilder.build()).build());
ab.withKey(new ActionKey(0));
final ActionBuilder ab = new ActionBuilder();
final SetTpSrcActionBuilder setTpSrcActionBuilder = new SetTpSrcActionBuilder();
- setTpSrcActionBuilder.setPort(new PortNumber(109));
+ setTpSrcActionBuilder.setPort(new PortNumber(Uint16.valueOf(109)));
ab.setAction(new SetTpSrcActionCaseBuilder().setSetTpSrcAction(setTpSrcActionBuilder.build()).build());
ab.withKey(new ActionKey(0));
actionList.add(ab.build());
ethDestBuilder.setAddress(new MacAddress("00:00:00:00:00:02"));
final EthernetMatchBuilder ethernetMatch2 = new EthernetMatchBuilder();
final EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
- ethTypeBuilder.setType(new EtherType(0x86ddL));
+ ethTypeBuilder.setType(new EtherType(Uint32.valueOf(0x86dd)));
ethernetMatch.setEthernetSource(ethSourceBuilder.build());
ethernetMatch1.setEthernetDestination(ethDestBuilder.build());
final VlanMatchBuilder vlanBuilder = new VlanMatchBuilder();
final VlanMatchBuilder vlanBuilder1 = new VlanMatchBuilder();
final VlanIdBuilder vlanIdBuilder = new VlanIdBuilder();
- final VlanId vlanId = new VlanId(10);
- final VlanPcp vpcp = new VlanPcp((short) 3);
+ final VlanId vlanId = new VlanId(Uint16.TEN);
+ final VlanPcp vpcp = new VlanPcp(Uint8.valueOf(3));
vlanBuilder.setVlanPcp(vpcp);
vlanBuilder1.setVlanId(vlanIdBuilder.setVlanId(vlanId).setVlanIdPresent(true).build());
setFieldBuilder.setVlanMatch(vlanBuilder.build());
final IpMatchBuilder ipmatch = new IpMatchBuilder();
final IpMatchBuilder ipmatch1 = new IpMatchBuilder();
final IpMatchBuilder ipmatch2 = new IpMatchBuilder();
- final Dscp dscp = new Dscp((short) 3);
+ final Dscp dscp = new Dscp(Uint8.valueOf(3));
ipmatch.setIpDscp(dscp);
- ipmatch1.setIpEcn((short) 2);
- ipmatch2.setIpProtocol((short) 120);
+ ipmatch1.setIpEcn(Uint8.TWO);
+ ipmatch2.setIpProtocol(Uint8.valueOf(120));
setFieldBuilder.setIpMatch(ipmatch.build());
ab.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder.build()).build());
ab.withKey(new ActionKey(0));
final SetFieldBuilder setFieldBuilder1 = new SetFieldBuilder();
// Tcp
- final PortNumber tcpsrcport = new PortNumber(1213);
- final PortNumber tcpdstport = new PortNumber(646);
+ final PortNumber tcpsrcport = new PortNumber(Uint16.valueOf(1213));
+ final PortNumber tcpdstport = new PortNumber(Uint16.valueOf(646));
final TcpMatchBuilder tcpmatch = new TcpMatchBuilder();
final TcpMatchBuilder tcpmatch1 = new TcpMatchBuilder();
tcpmatch.setTcpSourcePort(tcpsrcport);
final SetFieldBuilder setFieldBuilder1 = new SetFieldBuilder();
// Udp
- final PortNumber udpsrcport = new PortNumber(1325);
- final PortNumber udpdstport = new PortNumber(42);
+ final PortNumber udpsrcport = new PortNumber(Uint16.valueOf(1325));
+ final PortNumber udpdstport = new PortNumber(Uint16.valueOf(42));
final UdpMatchBuilder udpmatch = new UdpMatchBuilder();
final UdpMatchBuilder udpmatch1 = new UdpMatchBuilder();
udpmatch.setUdpDestinationPort(udpdstport);
// Sctp
final SctpMatchBuilder sctpmatch = new SctpMatchBuilder();
final SctpMatchBuilder sctpmatch1 = new SctpMatchBuilder();
- final PortNumber srcport = new PortNumber(1435);
- final PortNumber dstport = new PortNumber(22);
+ final PortNumber srcport = new PortNumber(Uint16.valueOf(1435));
+ final PortNumber dstport = new PortNumber(Uint16.valueOf(22));
sctpmatch.setSctpSourcePort(srcport);
sctpmatch1.setSctpDestinationPort(dstport);
setFieldBuilder.setLayer4Match(sctpmatch.build());
// Icmpv4
final Icmpv4MatchBuilder icmpv4match = new Icmpv4MatchBuilder();
final Icmpv4MatchBuilder icmpv4match1 = new Icmpv4MatchBuilder();
- icmpv4match.setIcmpv4Type((short) 8);
- icmpv4match1.setIcmpv4Code((short) 0);
+ icmpv4match.setIcmpv4Type(Uint8.valueOf(8));
+ icmpv4match1.setIcmpv4Code(Uint8.ZERO);
setFieldBuilder.setIcmpv4Match(icmpv4match.build());
ab.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder.build()).build());
ab.withKey(new ActionKey(0));
arpsrc.setAddress(macsrc);
final ArpTargetHardwareAddressBuilder arpdst = new ArpTargetHardwareAddressBuilder();
arpdst.setAddress(macdest);
- arpmatch.setArpOp(2);
+ arpmatch.setArpOp(Uint16.TWO);
arpmatch1.setArpSourceHardwareAddress(arpsrc.build());
arpmatch2.setArpTargetHardwareAddress(arpdst.build());
arpmatch3.setArpSourceTransportAddress(srciparp);
final Ipv6Prefix dstip6 = new Ipv6Prefix("2002::2/128");
final Ipv6Prefix srcip6 = new Ipv6Prefix("2001:0:0:0:0:0:0:1/128");
final Ipv6ExtHeaderBuilder nextheader = new Ipv6ExtHeaderBuilder();
- nextheader.setIpv6Exthdr(58);
+ nextheader.setIpv6Exthdr(Uint16.valueOf(58));
final Ipv6LabelBuilder ipv6label = new Ipv6LabelBuilder();
- final Ipv6FlowLabel label = new Ipv6FlowLabel(10028L);
+ final Ipv6FlowLabel label = new Ipv6FlowLabel(Uint32.valueOf(10028));
ipv6label.setIpv6Flabel(label);
ipv6Builder.setIpv6Source(srcip6);
// Icmpv6
final Icmpv6MatchBuilder icmpv6match = new Icmpv6MatchBuilder();
final Icmpv6MatchBuilder icmpv6match1 = new Icmpv6MatchBuilder();
- icmpv6match.setIcmpv6Type((short) 135);
- icmpv6match1.setIcmpv6Code((short) 0);
+ icmpv6match.setIcmpv6Type(Uint8.valueOf(135));
+ icmpv6match1.setIcmpv6Code(Uint8.ZERO);
setFieldBuilder.setIcmpv6Match(icmpv6match.build());
ab.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder.build()).build());
ab.withKey(new ActionKey(0));
final ProtocolMatchFieldsBuilder protomatch = new ProtocolMatchFieldsBuilder();
final ProtocolMatchFieldsBuilder protomatch1 = new ProtocolMatchFieldsBuilder();
final ProtocolMatchFieldsBuilder protomatch2 = new ProtocolMatchFieldsBuilder();
- protomatch.setMplsLabel((long) 36008);
- protomatch1.setMplsTc((short) 4);
- protomatch2.setMplsBos((short) 1);
+ protomatch.setMplsLabel(Uint32.valueOf(36008));
+ protomatch1.setMplsTc(Uint8.valueOf(4));
+ protomatch2.setMplsBos(Uint8.ONE);
setFieldBuilder.setProtocolMatchFields(protomatch.build());
ab.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder.build()).build());
ab.withKey(new ActionKey(0));
final SetFieldBuilder setFieldBuilder = new SetFieldBuilder();
// PBB
final ProtocolMatchFieldsBuilder protomatch = new ProtocolMatchFieldsBuilder();
- protomatch.setPbb(new PbbBuilder().setPbbIsid(4L).setPbbMask(
- new BigInteger(new byte[]{0, 1, 0, 0}).longValue()).build());
+ protomatch.setPbb(new PbbBuilder().setPbbIsid(Uint32.valueOf(4)).setPbbMask(Uint32.valueOf(0x10000)).build());
setFieldBuilder.setProtocolMatchFields(protomatch.build());
ab.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder.build()).build());
actionList.add(ab.build());
final SetFieldBuilder setFieldBuilder = new SetFieldBuilder();
// Tunnel
final TunnelBuilder tunnel = new TunnelBuilder();
- tunnel.setTunnelId(BigInteger.valueOf(10668));
+ tunnel.setTunnelId(Uint64.valueOf(10668));
setFieldBuilder.setTunnel(tunnel.build());
ab.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder.build()).build());
ab.withKey(new ActionKey(0));
final MatchBuilder match = new MatchBuilder();
final EthernetMatchBuilder eth = new EthernetMatchBuilder();
final EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
- ethTypeBuilder.setType(new EtherType(0x88ccL));
+ ethTypeBuilder.setType(new EtherType(Uint32.valueOf(0x88cc)));
eth.setEthernetType(ethTypeBuilder.build());
match.setEthernetMatch(eth.build());
return match;
final EthernetMatchBuilder eth = new EthernetMatchBuilder();
final EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
- ethTypeBuilder.setType(new EtherType(0x0800L));
+ ethTypeBuilder.setType(new EtherType(Uint32.valueOf(0x0800)));
eth.setEthernetType(ethTypeBuilder.build());
match.setEthernetMatch(eth.build());
return match;
final EthernetMatchBuilder eth = new EthernetMatchBuilder();
final EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
- ethTypeBuilder.setType(new EtherType(0x0800L));
+ ethTypeBuilder.setType(new EtherType(Uint32.valueOf(0x0800)));
eth.setEthernetType(ethTypeBuilder.build());
match.setEthernetMatch(eth.build());
return match;
final MatchBuilder match = new MatchBuilder();
final EthernetMatchBuilder eth = new EthernetMatchBuilder();
final EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
- ethTypeBuilder.setType(new EtherType(0x86ddL));
+ ethTypeBuilder.setType(new EtherType(Uint32.valueOf(0x86dd)));
eth.setEthernetType(ethTypeBuilder.build());
match.setEthernetMatch(eth.build());
final Icmpv6MatchBuilder icmpv6match = new Icmpv6MatchBuilder();
// match
- icmpv6match.setIcmpv6Type((short) 135);
- icmpv6match.setIcmpv6Code((short) 1);
+ icmpv6match.setIcmpv6Type(Uint8.valueOf(135));
+ icmpv6match.setIcmpv6Code(Uint8.ONE);
match.setIcmpv6Match(icmpv6match.build());
return match;
final EthernetMatchBuilder eth = new EthernetMatchBuilder();
final EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
- ethTypeBuilder.setType(new EtherType(0xfffeL));
+ ethTypeBuilder.setType(new EtherType(Uint32.valueOf(0xfffe)));
eth.setEthernetType(ethTypeBuilder.build());
match.setEthernetMatch(eth.build());
return match;
final EthernetMatchBuilder ethmatch = new EthernetMatchBuilder(); // ethernettype
// match
final EthernetTypeBuilder ethtype = new EthernetTypeBuilder();
- final EtherType type = new EtherType(0x0800L);
+ final EtherType type = new EtherType(Uint32.valueOf(0x0800));
ethmatch.setEthernetType(ethtype.setType(type).build());
final EthernetDestinationBuilder ethdest = new EthernetDestinationBuilder(); // ethernet
// vlan match
final VlanMatchBuilder vlanBuilder = new VlanMatchBuilder();
final VlanIdBuilder vlanIdBuilder = new VlanIdBuilder();
- final VlanId vlanId = new VlanId(10);
- final VlanPcp vpcp = new VlanPcp((short) 3);
+ final VlanId vlanId = new VlanId(Uint16.TEN);
+ final VlanPcp vpcp = new VlanPcp(Uint8.valueOf(3));
vlanBuilder.setVlanPcp(vpcp);
vlanIdBuilder.setVlanId(vlanId);
vlanIdBuilder.setVlanIdPresent(true);
final MacAddress macsrc = new MacAddress(SRC_MAC_ADDRESS);
final EthernetTypeBuilder ethtype = new EthernetTypeBuilder();
- final EtherType type = new EtherType(0x0806L);
+ final EtherType type = new EtherType(Uint32.valueOf(0x0806));
ethmatch.setEthernetType(ethtype.setType(type).build());
// ipv4 match
final ArpTargetHardwareAddressBuilder arpdst = new ArpTargetHardwareAddressBuilder();
arpdst.setAddress(macdest);
arpdst.setMask(new MacAddress("ff:ff:00:00:00:00"));
- arpmatch.setArpOp(2);
+ arpmatch.setArpOp(Uint16.TWO);
arpmatch.setArpSourceHardwareAddress(arpsrc.build());
arpmatch.setArpTargetHardwareAddress(arpdst.build());
arpmatch.setArpSourceTransportAddress(srcip);
final EthernetMatchBuilder eth = new EthernetMatchBuilder();
final EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
- ethTypeBuilder.setType(new EtherType(0x86ddL));
+ ethTypeBuilder.setType(new EtherType(Uint32.valueOf(0x86dd)));
eth.setEthernetType(ethTypeBuilder.build());
match.setEthernetMatch(eth.build());
final MacAddress ndsll = new MacAddress("c2:00:54:f5:00:00");
final MacAddress ndtll = new MacAddress("00:0c:29:0e:4c:67");
- final Ipv6ExtHeaderBuilder nextheader = new Ipv6ExtHeaderBuilder();
- nextheader.setIpv6Exthdr(58);
final Ipv6LabelBuilder ipv6label = new Ipv6LabelBuilder();
- final Ipv6FlowLabel label = new Ipv6FlowLabel(10028L);
+ final Ipv6FlowLabel label = new Ipv6FlowLabel(Uint32.valueOf(10028));
ipv6label.setIpv6Flabel(label);
- ipv6label.setFlabelMask(new Ipv6FlowLabel(1L));
+ ipv6label.setFlabelMask(new Ipv6FlowLabel(Uint32.ONE));
final Icmpv6MatchBuilder icmpv6match = new Icmpv6MatchBuilder(); // icmpv6
// match
- icmpv6match.setIcmpv6Type((short) 135);
- icmpv6match.setIcmpv6Code((short) 0);
+ icmpv6match.setIcmpv6Type(Uint8.valueOf(135));
+ icmpv6match.setIcmpv6Code(Uint8.ZERO);
match.setIcmpv6Match(icmpv6match.build());
final Ipv6MatchBuilder ipv6match = new Ipv6MatchBuilder();
final MatchBuilder match = new MatchBuilder();
final EthernetMatchBuilder eth = new EthernetMatchBuilder();
final EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
- ethTypeBuilder.setType(new EtherType(0x0800L));
+ ethTypeBuilder.setType(new EtherType(Uint32.valueOf(0x0800)));
eth.setEthernetType(ethTypeBuilder.build());
match.setEthernetMatch(eth.build());
final IpMatchBuilder ipmatch = new IpMatchBuilder(); // ipv4 version
- ipmatch.setIpProtocol((short) 1);
+ ipmatch.setIpProtocol(Uint8.ONE);
match.setIpMatch(ipmatch.build());
final Icmpv4MatchBuilder icmpv4match = new Icmpv4MatchBuilder(); // icmpv4
// match
- icmpv4match.setIcmpv4Type((short) 8);
- icmpv4match.setIcmpv4Code((short) 0);
+ icmpv4match.setIcmpv4Type(Uint8.valueOf(8));
+ icmpv4match.setIcmpv4Code(Uint8.ZERO);
match.setIcmpv4Match(icmpv4match.build());
return match;
}
final MatchBuilder match = new MatchBuilder();
final EthernetMatchBuilder eth = new EthernetMatchBuilder();
final EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
- ethTypeBuilder.setType(new EtherType(0x86ddL));
+ ethTypeBuilder.setType(new EtherType(Uint32.valueOf(0x86dd)));
eth.setEthernetType(ethTypeBuilder.build());
match.setEthernetMatch(eth.build());
final IpMatchBuilder ipmatch = new IpMatchBuilder(); // ipv4 version
- ipmatch.setIpProtocol((short) 58);
+ ipmatch.setIpProtocol(Uint8.valueOf(58));
match.setIpMatch(ipmatch.build());
final Icmpv6MatchBuilder icmpv6match = new Icmpv6MatchBuilder(); // icmpv6
// match
- icmpv6match.setIcmpv6Type((short) 135);
- icmpv6match.setIcmpv6Code((short) 1);
+ icmpv6match.setIcmpv6Type(Uint8.valueOf(135));
+ icmpv6match.setIcmpv6Code(Uint8.ONE);
match.setIcmpv6Match(icmpv6match.build());
return match;
final MatchBuilder match = new MatchBuilder();
final EthernetMatchBuilder ethmatch = new EthernetMatchBuilder();
final EthernetTypeBuilder ethtype = new EthernetTypeBuilder();
- final EtherType type = new EtherType(0x0800L);
+ final EtherType type = new EtherType(Uint32.valueOf(0x0800));
ethmatch.setEthernetType(ethtype.setType(type).build());
match.setEthernetMatch(ethmatch.build());
final IpMatchBuilder ipmatch = new IpMatchBuilder(); // ipv4 version
- ipmatch.setIpProtocol((short) 6);
- final Dscp dscp = new Dscp((short) 8);
+ ipmatch.setIpProtocol(Uint8.valueOf(6));
+ final Dscp dscp = new Dscp(Uint8.valueOf(8));
ipmatch.setIpDscp(dscp);
match.setIpMatch(ipmatch.build());
return match;
final EthernetMatchBuilder eth = new EthernetMatchBuilder();
final EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
- ethTypeBuilder.setType(new EtherType(0x0800L));
+ ethTypeBuilder.setType(new EtherType(Uint32.valueOf(0x0800)));
eth.setEthernetType(ethTypeBuilder.build());
match.setEthernetMatch(eth.build());
final IpMatchBuilder ipmatch = new IpMatchBuilder(); // ipv4 version
- ipmatch.setIpProtocol((short) 6);
+ ipmatch.setIpProtocol(Uint8.valueOf(6));
match.setIpMatch(ipmatch.build());
- final PortNumber srcport = new PortNumber(1213);
- final PortNumber dstport = new PortNumber(646);
+ final PortNumber srcport = new PortNumber(Uint16.valueOf(1213));
+ final PortNumber dstport = new PortNumber(Uint16.valueOf(646));
final TcpMatchBuilder tcpmatch = new TcpMatchBuilder(); // tcp match
tcpmatch.setTcpSourcePort(srcport);
tcpmatch.setTcpDestinationPort(dstport);
final EthernetMatchBuilder eth = new EthernetMatchBuilder();
final EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
- ethTypeBuilder.setType(new EtherType(0x0800L));
+ ethTypeBuilder.setType(new EtherType(Uint32.valueOf(0x0800)));
eth.setEthernetType(ethTypeBuilder.build());
match.setEthernetMatch(eth.build());
final IpMatchBuilder ipmatch = new IpMatchBuilder(); // ipv4 version
- ipmatch.setIpProtocol((short) 17);
+ ipmatch.setIpProtocol(Uint8.valueOf(17));
match.setIpMatch(ipmatch.build());
- final PortNumber srcport = new PortNumber(1325);
- final PortNumber dstport = new PortNumber(42);
+ final PortNumber srcport = new PortNumber(Uint16.valueOf(1325));
+ final PortNumber dstport = new PortNumber(Uint16.valueOf(42));
final UdpMatchBuilder udpmatch = new UdpMatchBuilder(); // udp match
udpmatch.setUdpDestinationPort(dstport);
udpmatch.setUdpSourcePort(srcport);
final EthernetMatchBuilder eth = new EthernetMatchBuilder();
final EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
- ethTypeBuilder.setType(new EtherType(0x0800L));
+ ethTypeBuilder.setType(new EtherType(Uint32.valueOf(0x0800)));
eth.setEthernetType(ethTypeBuilder.build());
match.setEthernetMatch(eth.build());
final IpMatchBuilder ipmatch = new IpMatchBuilder(); // ipv4 version
- ipmatch.setIpProtocol((short) 132);
+ ipmatch.setIpProtocol(Uint8.valueOf(132));
match.setIpMatch(ipmatch.build());
final SctpMatchBuilder sctpmatch = new SctpMatchBuilder();
- final PortNumber srcport = new PortNumber(1435);
- final PortNumber dstport = new PortNumber(22);
+ final PortNumber srcport = new PortNumber(Uint16.valueOf(1435));
+ final PortNumber dstport = new PortNumber(Uint16.valueOf(22));
sctpmatch.setSctpSourcePort(srcport);
sctpmatch.setSctpDestinationPort(dstport);
match.setLayer4Match(sctpmatch.build());
private static MatchBuilder createMetadataMatch() {
final MatchBuilder match = new MatchBuilder();
- final byte[] metamask = new byte[]{(byte) -1, (byte) -1, (byte) -1, 0, 0, 0, (byte) 1, (byte) 1};
final MetadataBuilder metadata = new MetadataBuilder(); // metadata match
- metadata.setMetadata(BigInteger.valueOf(500L));
- metadata.setMetadataMask(new BigInteger(1, metamask));
+ metadata.setMetadata(Uint64.valueOf(500));
+ metadata.setMetadataMask(Uint64.valueOf(0xFFFFFF00_00000101L));
match.setMetadata(metadata.build());
return match;
final EthernetMatchBuilder eth = new EthernetMatchBuilder();
final EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
- ethTypeBuilder.setType(new EtherType(0x8847L));
+ ethTypeBuilder.setType(new EtherType(Uint32.valueOf(0x8847)));
eth.setEthernetType(ethTypeBuilder.build());
match.setEthernetMatch(eth.build());
final ProtocolMatchFieldsBuilder protomatch = new ProtocolMatchFieldsBuilder(); // mpls
// match
- protomatch.setMplsLabel((long) 36008);
- protomatch.setMplsTc((short) 4);
- protomatch.setMplsBos((short) 1);
+ protomatch.setMplsLabel(Uint32.valueOf(36008));
+ protomatch.setMplsTc(Uint8.valueOf(4));
+ protomatch.setMplsBos(Uint8.ONE);
match.setProtocolMatchFields(protomatch.build());
return match;
final EthernetMatchBuilder eth = new EthernetMatchBuilder();
final EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
- ethTypeBuilder.setType(new EtherType(0x88E7L));
+ ethTypeBuilder.setType(new EtherType(Uint32.valueOf(0x88E7)));
eth.setEthernetType(ethTypeBuilder.build());
match.setEthernetMatch(eth.build());
final ProtocolMatchFieldsBuilder protomatch = new ProtocolMatchFieldsBuilder(); // mpls
// match
- protomatch.setPbb(new PbbBuilder().setPbbIsid(4L).setPbbMask(
- new BigInteger(new byte[]{0, 1, 0, 0}).longValue()).build());
+ protomatch.setPbb(new PbbBuilder().setPbbIsid(Uint32.valueOf(4)).setPbbMask(Uint32.valueOf(0x10000)).build());
match.setProtocolMatchFields(protomatch.build());
return match;
private static MatchBuilder createTunnelIDMatch() {
final MatchBuilder match = new MatchBuilder();
final TunnelBuilder tunnel = new TunnelBuilder(); // tunnel id match
- tunnel.setTunnelId(BigInteger.valueOf(10668));
- final byte[] mask = new byte[]{(byte) -1, (byte) -1, (byte) -1, 0, 0, 0, (byte) 1, (byte) 1};
- tunnel.setTunnelMask(new BigInteger(1, mask));
+ tunnel.setTunnelId(Uint64.valueOf(10668));
+ tunnel.setTunnelMask(Uint64.valueOf(0xFFFFFF00_00000101L));
match.setTunnel(tunnel.build());
return match;
// Ethertype match
final EthernetMatchBuilder ethernetType = new EthernetMatchBuilder();
final EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
- ethTypeBuilder.setType(new EtherType(0x0800L));
+ ethTypeBuilder.setType(new EtherType(Uint32.valueOf(0x0800)));
ethernetType.setEthernetType(ethTypeBuilder.build());
match.setEthernetMatch(ethernetType.build());
// TCP Protocol Match
final IpMatchBuilder ipMatch = new IpMatchBuilder(); // ipv4 version
- ipMatch.setIpProtocol((short) 6);
+ ipMatch.setIpProtocol(Uint8.valueOf(6));
match.setIpMatch(ipMatch.build());
// TCP Port Match
- final PortNumber dstPort = new PortNumber(80);
+ final PortNumber dstPort = new PortNumber(Uint16.valueOf(80));
final TcpMatchBuilder tcpMatch = new TcpMatchBuilder();
tcpMatch.setTcpDestinationPort(dstPort);
match.setLayer4Match(tcpMatch.build());
* TCP_ECE 0x040 / TCP_CWR 0x080 / TCP_NS 0x100
*/
final TcpFlagsMatchBuilder tcpFlagsMatch = new TcpFlagsMatchBuilder();
- tcpFlagsMatch.setTcpFlags(0x002);
+ tcpFlagsMatch.setTcpFlags(Uint16.valueOf(0x002));
match.setTcpFlagsMatch(tcpFlagsMatch.build());
return match;
.augmentation(FlowCapableNode.class).child(Table.class, new TableKey(tf.getTableId()))
.child(Flow.class, tf.key());
modification.delete(LogicalDatastoreType.CONFIGURATION, path1);
- modification.commit().addCallback(new FutureCallback<Object>() {
+ modification.commit().addCallback(new FutureCallback<CommitInfo>() {
@Override
- public void onSuccess(final Object notUsed) {
+ public void onSuccess(final CommitInfo notUsed) {
ci.println("Status of Group Data Loaded Transaction: success.");
}
modification.mergeParentStructureMerge(LogicalDatastoreType.CONFIGURATION,
nodeBuilderToInstanceId(nodeBuilder), nodeBuilder.build());
modification.mergeParentStructureMerge(LogicalDatastoreType.CONFIGURATION, path1, flow.build());
- modification.commit().addCallback(new FutureCallback<Object>() {
+ modification.commit().addCallback(new FutureCallback<CommitInfo>() {
@Override
- public void onSuccess(final Object notUsed) {
+ public void onSuccess(final CommitInfo notUsed) {
ci.println("Status of Group Data Loaded Transaction: success.");
}