MatchField transportPort = sourceMatch.getField(matchType);
if (transportPort != null && transportPort.getValue() != null
&& transportPort.getValue().getClass().equals(Short.class)) {
- return new Integer(NetUtils.getUnsignedShort((short) transportPort
- .getValue()));
+ return NetUtils.getUnsignedShort((short) transportPort.getValue());
}
return null;
}
final MatchField dataLinkType = sourceMatch.getField(MatchType.DL_TYPE);
if (dataLinkType != null && dataLinkType.getValue() != null) {
- EtherType etherType = new EtherType(new Long(
- NetUtils.getUnsignedShort((Short) dataLinkType.getValue())));
+ EtherType etherType = new EtherType((long) NetUtils.getUnsignedShort((Short) dataLinkType.getValue()));
EthernetTypeBuilder ethType = new EthernetTypeBuilder()
.setType(etherType);
targetEthMatchBuild.setEthernetType(ethType.build());
target.setField(DL_DST, bytesFrom(targetHwAddress.getAddress()));
}
- target.setField(DL_TYPE, new Short(ETHERNET_ARP));
+ target.setField(DL_TYPE, ETHERNET_ARP);
}
}
private Short getShortValue() {
- return new Short((short) protocol);
+ return (short) protocol;
}
private IPProtocols fromProtocolNum(Short protocolNum) {
// v1.0 ports
final ImmutableBiMap<String, Long> OFv10 = new ImmutableBiMap.Builder<String, Long>()
- .put(OutputPortValues.MAX.toString(), new Long(PortNumberValuesV10.MAX.getIntValue())) //0xff00
- .put(OutputPortValues.INPORT.toString(), new Long(PortNumberValuesV10.INPORT.getIntValue())) //0xfff8
- .put(OutputPortValues.TABLE.toString(), new Long(PortNumberValuesV10.TABLE.getIntValue())) //0xfff9
- .put(OutputPortValues.NORMAL.toString(), new Long(PortNumberValuesV10.NORMAL.getIntValue())) //0xfffa
- .put(OutputPortValues.FLOOD.toString(), new Long(PortNumberValuesV10.FLOOD.getIntValue())) //0xfffb
- .put(OutputPortValues.ALL.toString(), new Long(PortNumberValuesV10.ALL.getIntValue())) //0xfffc
- .put(OutputPortValues.CONTROLLER.toString(), new Long(PortNumberValuesV10.CONTROLLER.getIntValue())) //0xfffd
- .put(OutputPortValues.LOCAL.toString(), new Long(PortNumberValuesV10.LOCAL.getIntValue())) //0xfffe
- .put(OutputPortValues.NONE.toString(), new Long(PortNumberValuesV10.NONE.getIntValue())) //0xfffe
+ .put(OutputPortValues.MAX.toString(), Long.valueOf(PortNumberValuesV10.MAX.getIntValue())) //0xff00
+ .put(OutputPortValues.INPORT.toString(), Long.valueOf(PortNumberValuesV10.INPORT.getIntValue())) //0xfff8
+ .put(OutputPortValues.TABLE.toString(), Long.valueOf(PortNumberValuesV10.TABLE.getIntValue())) //0xfff9
+ .put(OutputPortValues.NORMAL.toString(), Long.valueOf(PortNumberValuesV10.NORMAL.getIntValue())) //0xfffa
+ .put(OutputPortValues.FLOOD.toString(), Long.valueOf(PortNumberValuesV10.FLOOD.getIntValue())) //0xfffb
+ .put(OutputPortValues.ALL.toString(), Long.valueOf(PortNumberValuesV10.ALL.getIntValue())) //0xfffc
+ .put(OutputPortValues.CONTROLLER.toString(), Long.valueOf(PortNumberValuesV10.CONTROLLER.getIntValue())) //0xfffd
+ .put(OutputPortValues.LOCAL.toString(), Long.valueOf(PortNumberValuesV10.LOCAL.getIntValue())) //0xfffe
+ .put(OutputPortValues.NONE.toString(), Long.valueOf(PortNumberValuesV10.NONE.getIntValue())) //0xfffe
.build();
// openflow 1.3 reserved ports.
private static InstructionsBuilder createMeterInstructions() {
MeterBuilder aab = new MeterBuilder();
- aab.setMeterId(new MeterId(new Long(1)));
+ aab.setMeterId(new MeterId(1L));
InstructionBuilder ib = new InstructionBuilder();
ib.setInstruction(new MeterCaseBuilder().setMeter(aab.build()).build());
ActionBuilder ab = new ActionBuilder();
PushMplsActionBuilder push = new PushMplsActionBuilder();
- push.setEthernetType(new Integer(0x8847));
+ push.setEthernetType(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(new Integer(0x88E7));
+ pbb.setEthernetType(0x88E7);
ab.setAction(new PushPbbActionCaseBuilder().setPushPbbAction(pbb.build()).build());
actionList.add(ab.build());
// Create an Apply Action
if (null == flow.isBarrier()) {
flow.setBarrier(Boolean.FALSE);
}
- // flow.setBufferId(new Long(12));
- BigInteger value = new BigInteger("10", 10);
- BigInteger outputPort = new BigInteger("4294967295", 10);
+ // 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.setFlags(new FlowModFlags(false, false, false, false, true));
flow.setId(new FlowId("12"));
flow.setTableId(getTableId(tableId));
- flow.setOutGroup(new Long("4294967295"));
+ flow.setOutGroup(4294967295L);
// set outport to OFPP_NONE (65535) to disable remove restriction for
// flow
flow.setOutPort(outputPort);
private List<Action> createPushVlanAction() {
PushVlanActionBuilder vlan = new PushVlanActionBuilder();
- vlan.setEthernetType(new Integer(0x8100));
+ vlan.setEthernetType(0x8100);
VlanId v = new VlanId(2);
vlan.setVlanId(v);
ActionBuilder action = new ActionBuilder();
private List<Action> createPushMplsAction() {
PushMplsActionBuilder push = new PushMplsActionBuilder();
- push.setEthernetType(new Integer(0x8847));
+ push.setEthernetType(0x8847);
ActionBuilder action = new ActionBuilder();
action.setAction(new PushMplsActionCaseBuilder().setPushMplsAction(push.build()).build());
List<Action> actions = new ArrayList<Action>();
private List<Action> createPushPbbAction() {
PushPbbActionBuilder pbb = new PushPbbActionBuilder();
- pbb.setEthernetType(new Integer(0x88E7));
+ pbb.setEthernetType(0x88E7);
ActionBuilder action = new ActionBuilder();
action.setAction(new PushPbbActionCaseBuilder().setPushPbbAction(pbb.build()).build());
List<Action> actions = new ArrayList<Action>();
if (null == flow.isBarrier()) {
flow.setBarrier(Boolean.FALSE);
}
- // flow.setBufferId(new Long(12));
- BigInteger value = new BigInteger("10", 10);
- BigInteger outputPort = new BigInteger("4294967295", 10);
+ // 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.setFlags(new FlowModFlags(false, false, false, false, true));
flow.setId(new FlowId("12"));
flow.setTableId(getTableId(tableId));
- flow.setOutGroup(new Long("4294967295"));
+ flow.setOutGroup(4294967295L);
// set outport to OFPP_NONE (65535) to disable remove restriction for
// flow
flow.setOutPort(outputPort);
private static InstructionsBuilder createMeterInstructions() {
MeterBuilder aab = new MeterBuilder();
- aab.setMeterId(new MeterId(new Long(1)));
+ aab.setMeterId(new MeterId(1L));
InstructionBuilder ib = new InstructionBuilder();
ib.setInstruction(new MeterCaseBuilder().setMeter(aab.build()).build());
ActionBuilder ab = new ActionBuilder();
OutputActionBuilder output = new OutputActionBuilder();
- output.setMaxLength(new Integer(0xffff));
+ output.setMaxLength(0xffff);
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(new Integer(0x8847));
+ push.setEthernetType(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(new Integer(0x88E7));
+ pbb.setEthernetType(0x88E7);
ab.setAction(new PushPbbActionCaseBuilder().setPushPbbAction(pbb.build()).build());
actionList.add(ab.build());
// Create an Apply Action
private List<Action> createPushVlanAction() {
PushVlanActionBuilder vlan = new PushVlanActionBuilder();
- vlan.setEthernetType(new Integer(0x8100));
+ vlan.setEthernetType(0x8100);
ActionBuilder action = new ActionBuilder();
action.setAction(new PushVlanActionCaseBuilder().setPushVlanAction(vlan.build()).build());
List<Action> actions = new ArrayList<Action>();
private List<Action> createPushMplsAction() {
PushMplsActionBuilder push = new PushMplsActionBuilder();
- push.setEthernetType(new Integer(0x8847));
+ push.setEthernetType(0x8847);
ActionBuilder action = new ActionBuilder();
action.setAction(new PushMplsActionCaseBuilder().setPushMplsAction(push.build()).build());
List<Action> actions = new ArrayList<Action>();
private List<Action> createPushPbbAction() {
PushPbbActionBuilder pbb = new PushPbbActionBuilder();
- pbb.setEthernetType(new Integer(0x88E7));
+ pbb.setEthernetType(0x88E7);
ActionBuilder action = new ActionBuilder();
action.setAction(new PushPbbActionCaseBuilder().setPushPbbAction(pbb.build()).build());
List<Action> actions = new ArrayList<Action>();
List<Action> actionList = new ArrayList<Action>();
ActionBuilder ab = new ActionBuilder();
PushMplsActionBuilder push = new PushMplsActionBuilder();
- push.setEthernetType(new Integer(0x8849));
+ push.setEthernetType(0x8849);
ab.setAction(new PushMplsActionCaseBuilder().setPushMplsAction(push.build()).build());
actionList.add(ab.build());
return actionList;
List<Action> actionList = new ArrayList<Action>();
ActionBuilder ab = new ActionBuilder();
PushPbbActionBuilder pbb = new PushPbbActionBuilder();
- pbb.setEthernetType(new Integer(0x88E8));
+ pbb.setEthernetType(0x88E8);
ab.setAction(new PushPbbActionCaseBuilder().setPushPbbAction(pbb.build()).build());
actionList.add(ab.build());
return actionList;
List<Action> actionList = new ArrayList<Action>();
ActionBuilder ab = new ActionBuilder();
PushVlanActionBuilder vlan = new PushVlanActionBuilder();
- vlan.setEthernetType(new Integer(0x8101));
+ vlan.setEthernetType(0x8101);
ab.setAction(new PushVlanActionCaseBuilder().setPushVlanAction(vlan.build()).build());
actionList.add(ab.build());
return actionList;
TableFeaturesBuilder tableFeature1 = new TableFeaturesBuilder();
- tableFeature1.setTableId(new Short((short) 0));
+ tableFeature1.setTableId((short) 0);
tableFeature1.setName("Table 0");
- tableFeature1.setMetadataMatch((new BigInteger("10", 10)));
- tableFeature1.setMetadataWrite((new BigInteger("10", 10)));
- tableFeature1.setMaxEntries(new Long(10000));
+ tableFeature1.setMetadataMatch(BigInteger.valueOf(10));
+ tableFeature1.setMetadataWrite(BigInteger.valueOf(10));
+ tableFeature1.setMaxEntries(10000L);
tableFeature1.setConfig(new TableConfig(false));
private NodeBuilder createTestNode(String nodeId) {
String localNodeId;
-
+
if (nodeId == null) {
localNodeId = OpenflowpluginTestActivator.NODE_ID;
} else {
localNodeId = nodeId;
}
-
+
NodeBuilder builder = new NodeBuilder();
builder.setId(new NodeId(localNodeId));
builder.setKey(new NodeKey(builder.getId()));
private FlowBuilder createTestFlow(NodeBuilder nodeBuilder, String flowTypeArg, String tableId) {
final long TEST_ID = 123;
-
+
FlowBuilder flow = new FlowBuilder();
long id = TEST_ID;
break;
case "f83":
// Test TCP_Flag Match
- id += 83;
+ id += 83;
flow.setMatch(createTcpFlagMatch().build());
flow.setInstructions(createDropInstructions().build());
break;
case "f84":
id += 84;
// match vlan=10,dl_vlan_pcp=3
- flow.setMatch(createVlanMatch().build());
+ flow.setMatch(createVlanMatch().build());
// vlan_pcp=4
- flow.setInstructions(createAppyActionInstruction88().build());
+ flow.setInstructions(createAppyActionInstruction88().build());
break;
case "f85":
// Test Tunnel IPv4 Src (e.g. set_field:172.16.100.200->tun_src)
- id += 85;
+ id += 85;
flow.setMatch(createMatch3().build());
flow.setInstructions(createTunnelIpv4SrcInstructions().build());
break;
case "f86":
// Test Tunnel IPv4 Dst (e.g. set_field:172.16.100.100->tun_dst)
- id += 86;
+ id += 86;
flow.setMatch(createMatch1().build());
flow.setInstructions(createTunnelIpv4DstInstructions().build());
break;
FlowBuilder flow = new FlowBuilder();
String flowType = flowTypeArg;
int flowId = id;
-
+
if (flowType == null) {
flowType = "f1";
}
try {
table = Short.parseShort(tableId);
} catch (Exception ex) {
- LOG.info("Parsing String tableId {} failed. Continuing with default tableId {}.",
+ LOG.info("Parsing String tableId {} failed. Continuing with default tableId {}.",
tableId, table);
}
return table;
private static InstructionsBuilder createMeterInstructions() {
MeterBuilder aab = new MeterBuilder();
- aab.setMeterId(new MeterId(new Long(1)));
+ aab.setMeterId(new MeterId(1L));
InstructionBuilder ib = new InstructionBuilder();
ib.setInstruction(new MeterCaseBuilder().setMeter(aab.build()).build());
match.setEthernetMatch(eth.build());
// ipv4 version
- IpMatchBuilder ipmatch = new IpMatchBuilder();
+ IpMatchBuilder ipmatch = new IpMatchBuilder();
ipmatch.setIpProtocol((short) 256);
match.setIpMatch(ipmatch.build());
-
+
// icmpv6
Icmpv6MatchBuilder icmpv6match = new Icmpv6MatchBuilder();
-
+
// match
icmpv6match.setIcmpv6Type((short) 135);
icmpv6match.setIcmpv6Code((short) 1);
private static MatchBuilder createVlanMatch() {
MatchBuilder match = new MatchBuilder();
// vlan match
- VlanMatchBuilder vlanBuilder = new VlanMatchBuilder();
+ VlanMatchBuilder vlanBuilder = new VlanMatchBuilder();
VlanIdBuilder vlanIdBuilder = new VlanIdBuilder();
VlanId vlanId = new VlanId(10);
VlanPcp vpcp = new VlanPcp((short) 3);
ethmatch.setEthernetType(ethtype.setType(type).build());
// ipv4 match
- Ipv4Prefix dstip = new Ipv4Prefix("200.71.9.52/10");
+ Ipv4Prefix dstip = new Ipv4Prefix("200.71.9.52/10");
Ipv4Prefix srcip = new Ipv4Prefix("100.1.1.1/8");
// arp match
- ArpMatchBuilder arpmatch = new ArpMatchBuilder();
+ ArpMatchBuilder arpmatch = new ArpMatchBuilder();
ArpSourceHardwareAddressBuilder arpsrc = new ArpSourceHardwareAddressBuilder();
arpsrc.setAddress(macsrc);
arpsrc.setMask(new MacAddress("ff:ff:ff:00:00:00"));
Ipv4MatchBuilder ipv4Match = new Ipv4MatchBuilder();
// ipv4 match
- Ipv4Prefix dstip = new Ipv4Prefix("200.71.9.52/10");
+ Ipv4Prefix dstip = new Ipv4Prefix("200.71.9.52/10");
Ipv4Prefix srcip = new Ipv4Prefix("100.1.1.1/8");
Ipv4MatchBuilder ipv4match = new Ipv4MatchBuilder();
ipv4match.setIpv4Destination(dstip);