import org.opendaylight.sfc.genius.util.appcoexistence.SfcTableIndexMapper;
import org.opendaylight.sfc.ofrenderer.sfg.GroupBucketInfo;
import org.opendaylight.sfc.sfc_ovs.provider.SfcOvsUtil;
+import org.opendaylight.sfc.util.openflow.OpenflowConstants;
import org.opendaylight.sfc.util.openflow.SfcOpenflowUtils;
import org.opendaylight.sfc.util.openflow.transactional_writer.SfcOfFlowWriterInterface;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress;
public static final String TRANSPORT_EGRESS_MPLS_LASTHOP_COOKIE = "00000402";
public static final String TRANSPORT_EGRESS_MAX_COOKIE = "00000FFF";
+ private static final String INGRESS_TRANSPORT_ARP_FLOW_NAME_LITERAL = "ingress_Transport_Arp_Flow";
+ private static final String NEXT_HOP_FLOW_NAME_LITERAL = "nextHop";
+
// Which bits in the metadata field to set, Assuming 4095 PathId's
public static final BigInteger METADATA_MASK_SFP_MATCH =
new BigInteger("FFFFFFFFFFFFFFFF", COOKIE_BIGINT_HEX_RADIX);
private static final int PKTIN_IDLE_TIMEOUT = 60;
private static final String EMPTY_SWITCH_PORT = "";
public static final short APP_COEXISTENCE_NOT_SET = -1;
- private static final short TUN_GPE_NP_NSH = 0x4;
// Instance variables
private short tableBase;
@Override
public void setFlowWriter(SfcOfFlowWriterInterface sfcOfFlowWriter) {
this.sfcOfFlowWriter = sfcOfFlowWriter;
- };
+ }
// This method should only be called by SfcOfRenderer.close()
@Override
SfcOpenflowUtils.createFlowBuilder(
getTableId(TABLE_INDEX_TRANSPORT_INGRESS),
FLOW_PRIORITY_ARP_TRANSPORT_INGRESS,
- "ingress_Transport_Arp_Flow",
+ INGRESS_TRANSPORT_ARP_FLOW_NAME_LITERAL,
match, isb);
sfcOfFlowWriter.writeFlow(flowRspId, sffNodeName, arpTransportIngressFlow);
SfcOpenflowUtils.createFlowBuilder(
getTableId(TABLE_INDEX_TRANSPORT_INGRESS),
FLOW_PRIORITY_ARP_TRANSPORT_INGRESS,
- "ingress_Transport_Arp_Flow",
+ INGRESS_TRANSPORT_ARP_FLOW_NAME_LITERAL,
match, isb);
sfcOfFlowWriter.writeFlow(flowRspId, sffNodeName, sfFlow);
SfcOpenflowUtils.createFlowBuilder(
getTableId(TABLE_INDEX_TRANSPORT_INGRESS),
FLOW_PRIORITY_ARP_TRANSPORT_INGRESS,
- "ingress_Transport_Arp_Flow",
+ INGRESS_TRANSPORT_ARP_FLOW_NAME_LITERAL,
match, isb);
sfcOfFlowWriter.writeFlow(flowRspId, sffNodeName, sfFlow);
return SfcOpenflowUtils.createFlowBuilder(
getTableId(TABLE_INDEX_PATH_MAPPER),
flowPriority,
- "nextHop", match, isb);
+ NEXT_HOP_FLOW_NAME_LITERAL, match, isb);
}
//
FlowBuilder ingressFlow = SfcOpenflowUtils.createFlowBuilder(
getTableId(TABLE_INDEX_PATH_MAPPER_ACL),
FLOW_PRIORITY_PATH_MAPPER_ACL,
- "nextHop",
+ NEXT_HOP_FLOW_NAME_LITERAL,
match, isb);
// Set an idle timeout on this flow
ingressFlow.setIdleTimeout(PKTIN_IDLE_TIMEOUT);
List<Action> actionList = new ArrayList<>();
if (dstMac != null) {
// Set the DL (Data Link) Dest Mac Address
- actionList.add(SfcOpenflowUtils.createActionSetDlDst(dstMac, 0));
+ actionList.add(SfcOpenflowUtils.createActionSetDlDst(dstMac, actionList.size()));
}
FlowBuilder nextHopFlow = configureNextHopFlow(match, actionList, flowPriority);
final short nshNsi) {
MatchBuilder match = SfcOpenflowUtils.getNshMatches(nshNsp, nshNsi);
- int order = 0;
List<Action> actionList = new ArrayList<>();
if (dstIp != null) {
- Action actionSetNwDst = SfcOpenflowUtils.createActionNxSetTunIpv4Dst(dstIp, order++);
+ Action actionSetNwDst = SfcOpenflowUtils.createActionNxSetTunIpv4Dst(dstIp, actionList.size());
actionList.add(actionSetNwDst);
}
@Override
public void configureNshEthNextHopFlow(String sffNodeName, String srcMac, String dstMac, long nsp, short nsi) {
MatchBuilder match = SfcOpenflowUtils.getNshMatches(nsp, nsi);
- int order = 0;
+
List<Action> actionList = new ArrayList<>();
actionList.add(SfcOpenflowUtils.createActionNxLoadEncapEthSrc(srcMac,
- order++));
+ actionList.size()));
actionList.add(SfcOpenflowUtils.createActionNxLoadEncapEthDst(dstMac,
- order++));
+ actionList.size()));
FlowBuilder nextHopFlow = configureNextHopFlow(match, actionList);
sfcOfFlowWriter.writeFlow(flowRspId, sffNodeName, nextHopFlow);
// Create and configure the FlowBuilder
return SfcOpenflowUtils.createFlowBuilder(
getTableId(TABLE_INDEX_NEXT_HOP),
- flowPriority, "nextHop", match, isb);
+ flowPriority, NEXT_HOP_FLOW_NAME_LITERAL, match, isb);
}
// In order to set the IP DSCP, we need to match IPv4
SfcOpenflowUtils.addMatchEtherType(match, SfcOpenflowUtils.ETHERTYPE_IPV4);
- int order = 0;
List<Action> actionList = new ArrayList<>();
- actionList.add(SfcOpenflowUtils.createActionWriteDscp((short) pathId, order++));
- actionList.add(SfcOpenflowUtils.createActionPushVlan(order++));
- actionList.add(SfcOpenflowUtils.createActionSetVlanId(dstVlan, order++));
+ actionList.add(SfcOpenflowUtils.createActionWriteDscp((short) pathId, actionList.size()));
+ actionList.add(SfcOpenflowUtils.createActionPushVlan(actionList.size()));
+ actionList.add(SfcOpenflowUtils.createActionSetVlanId(dstVlan, actionList.size()));
if(doPktin) {
// Notice TCP SYN matching is only supported in OpenFlow 1.5
SfcOpenflowUtils.addMatchTcpSyn(match);
- actionList.add(SfcOpenflowUtils.createActionPktIn(SfcOpenflowUtils.PKT_LENGTH_IP_HEADER, order++));
+ actionList.add(SfcOpenflowUtils.createActionPktIn(SfcOpenflowUtils.PKT_LENGTH_IP_HEADER, actionList.size()));
}
FlowBuilder transportEgressFlow =
configureMacTransportEgressFlow(
- match, actionList, port, order, pathId, srcMac, dstMac,
+ match, actionList, port, pathId, srcMac, dstMac,
TRANSPORT_EGRESS_VLAN_SF_COOKIE);
sfcOfFlowWriter.writeFlow(flowRspId, sffNodeName, transportEgressFlow);
}
MatchBuilder match = new MatchBuilder();
SfcOpenflowUtils.addMatchMetada(match, getMetadataSFP(pathId), METADATA_MASK_SFP_MATCH);
- int order = 0;
List<Action> actionList = new ArrayList<>();
- actionList.add(SfcOpenflowUtils.createActionPushVlan(order++));
- actionList.add(SfcOpenflowUtils.createActionSetVlanId(dstVlan, order++));
+ actionList.add(SfcOpenflowUtils.createActionPushVlan(actionList.size()));
+ actionList.add(SfcOpenflowUtils.createActionSetVlanId(dstVlan, actionList.size()));
FlowBuilder transportEgressFlow =
configureMacTransportEgressFlow(
- match, actionList, port, order, pathId, srcMac, dstMac, cookieStr);
+ match, actionList, port, pathId, srcMac, dstMac, cookieStr);
sfcOfFlowWriter.writeFlow(flowRspId, sffNodeName, transportEgressFlow);
}
MatchBuilder match = new MatchBuilder();
SfcOpenflowUtils.addMatchMetada(match, getMetadataSFP(pathId), METADATA_MASK_SFP_MATCH);
- int order = 0;
List<Action> actionList = new ArrayList<>();
- actionList.add(SfcOpenflowUtils.createActionPushMpls(order++));
- actionList.add(SfcOpenflowUtils.createActionSetMplsLabel(mplsLabel, order++));
+ actionList.add(SfcOpenflowUtils.createActionPushMpls(actionList.size()));
+ actionList.add(SfcOpenflowUtils.createActionSetMplsLabel(mplsLabel, actionList.size()));
FlowBuilder transportEgressFlow =
configureMacTransportEgressFlow(
- match, actionList, port, order, pathId, srcMac, dstMac, cookieStr);
+ match, actionList, port, pathId, srcMac, dstMac, cookieStr);
sfcOfFlowWriter.writeFlow(flowRspId, sffNodeName, transportEgressFlow);
}
MatchBuilder match = SfcOpenflowUtils.getNshMatches(nshNsp, nshNsi);
// On the last hop Copy/Move Nsi, Nsp, Nsc1=>TunIpv4Dst, and Nsc2=>TunId(Vnid)
- int order = 0;
List<Action> actionList = new ArrayList<>();
- actionList.add(SfcOpenflowUtils.createActionNxMoveNshMdtype(order++));
- actionList.add(SfcOpenflowUtils.createActionNxMoveNshNp(order++));
- actionList.add(SfcOpenflowUtils.createActionNxMoveNsi(order++));
- actionList.add(SfcOpenflowUtils.createActionNxMoveNsp(order++));
- actionList.add(SfcOpenflowUtils.createActionNxMoveNsc1ToTunIpv4DstRegister(order++));
- actionList.add(SfcOpenflowUtils.createActionNxMoveNsc2ToTunIdRegister(order++));
+ actionList.add(SfcOpenflowUtils.createActionNxMoveNshMdtype(actionList.size()));
+ actionList.add(SfcOpenflowUtils.createActionNxMoveNshNp(actionList.size()));
+ actionList.add(SfcOpenflowUtils.createActionNxMoveNsi(actionList.size()));
+ actionList.add(SfcOpenflowUtils.createActionNxMoveNsp(actionList.size()));
+ actionList.add(SfcOpenflowUtils.createActionNxMoveNsc1ToTunIpv4DstRegister(actionList.size()));
+ actionList.add(SfcOpenflowUtils.createActionNxMoveNsc2ToTunIdRegister(actionList.size()));
/* Need to set TUN_GPE_NP for VxLAN-gpe port */
- actionList.add(SfcOpenflowUtils.createActionNxLoadTunGpeNp(TUN_GPE_NP_NSH, order++));
+ actionList.add(SfcOpenflowUtils.createActionNxLoadTunGpeNp(OpenflowConstants.TUN_GPE_NP_NSH, actionList.size()));
FlowBuilder transportEgressFlow =
- configureTransportEgressFlow(match, actionList, port, order,
+ configureTransportEgressFlow(match, actionList, port,
FLOW_PRIORITY_TRANSPORT_EGRESS,
TRANSPORT_EGRESS_NSH_VXGPE_LASTHOP_COOKIE);
sfcOfFlowWriter.writeFlow(flowRspId, sffNodeName, transportEgressFlow);
// 1. remove nsh header
// 2. Change src mac to the mac of the last SF
// 3. resubmit to the dispatcher table
- int order = 0;
List<Action> actionList = new ArrayList<>();
// Pop NSH
- Action popNsh = SfcOpenflowUtils.createActionNxPopNsh(order++);
+ Action popNsh = SfcOpenflowUtils.createActionNxPopNsh(actionList.size());
actionList.add(popNsh);
// Change source address
Action changeSourceMac = SfcOpenflowUtils
- .createActionSetDlSrc(macAddress.getValue(), order++);
+ .createActionSetDlSrc(macAddress.getValue(), actionList.size());
actionList.add(changeSourceMac);
// Proceed with other services
- actionList.add(SfcOpenflowUtils.createActionResubmitTable(NwConstants.LPORT_DISPATCHER_TABLE, order++));
+ actionList.add(SfcOpenflowUtils.createActionResubmitTable(NwConstants.LPORT_DISPATCHER_TABLE, actionList.size()));
InstructionsBuilder isb = SfcOpenflowUtils.wrapActionsIntoApplyActionsInstruction(actionList);
private void configureNshVxgpeTransportEgressFlowPorts(
final String sffNodeName, final long nshNsp, final short nshNsi, String inport, String outport) {
int flowPriority = FLOW_PRIORITY_TRANSPORT_EGRESS;
+ String theOutPortToSet = outport;
MatchBuilder match = SfcOpenflowUtils.getNshMatches(nshNsp, nshNsi);
if(!inport.startsWith(OutputPortValues.INPORT.toString())) {
// if we output to a port that's the same as the inport, the pkt will be dropped
SfcOpenflowUtils.addMatchInPort(match, new NodeConnectorId(inport));
- outport = OutputPortValues.INPORT.toString();
+ theOutPortToSet = OutputPortValues.INPORT.toString();
flowPriority += 5;
}
- int order = 0;
List<Action> actionList = new ArrayList<>();
// Copy/Move Nsc1/Nsc2 to the next hop
- actionList.add(SfcOpenflowUtils.createActionNxMoveNshMdtype(order++));
- actionList.add(SfcOpenflowUtils.createActionNxMoveNshNp(order++));
- actionList.add(SfcOpenflowUtils.createActionNxMoveNsc1(order++));
- actionList.add(SfcOpenflowUtils.createActionNxMoveNsc2(order++));
- actionList.add(SfcOpenflowUtils.createActionNxMoveTunIdRegister(order++));
+ actionList.add(SfcOpenflowUtils.createActionNxMoveNshMdtype(actionList.size()));
+ actionList.add(SfcOpenflowUtils.createActionNxMoveNshNp(actionList.size()));
+ actionList.add(SfcOpenflowUtils.createActionNxMoveNsc1(actionList.size()));
+ actionList.add(SfcOpenflowUtils.createActionNxMoveNsc2(actionList.size()));
+ actionList.add(SfcOpenflowUtils.createActionNxMoveTunIdRegister(actionList.size()));
/* Need to set TUN_GPE_NP for VxLAN-gpe port */
- actionList.add(SfcOpenflowUtils.createActionNxLoadTunGpeNp(TUN_GPE_NP_NSH, order++));
+ actionList.add(SfcOpenflowUtils.createActionNxLoadTunGpeNp(OpenflowConstants.TUN_GPE_NP_NSH,actionList.size()));
FlowBuilder transportEgressFlow =
- configureTransportEgressFlow(match, actionList, outport, order,
+ configureTransportEgressFlow(match, actionList, theOutPortToSet,
flowPriority,
TRANSPORT_EGRESS_NSH_VXGPE_COOKIE);
sfcOfFlowWriter.writeFlow(flowRspId, sffNodeName, transportEgressFlow);
SfcOpenflowUtils.addMatchNshNsc1(match, 0l);
/* Need to set TUN_GPE_NP for VxLAN-gpe port */
- int order = 0;
List<Action> actionList = new ArrayList<>();
- actionList.add(SfcOpenflowUtils.createActionNxLoadTunGpeNp(TUN_GPE_NP_NSH, order++));
+ actionList.add(SfcOpenflowUtils.createActionNxLoadTunGpeNp(OpenflowConstants.TUN_GPE_NP_NSH, actionList.size()));
FlowBuilder transportEgressFlow =
configureTransportEgressFlow(
- match, new ArrayList<>(), port,
- order, FLOW_PRIORITY_TRANSPORT_EGRESS + 10,
+ match, actionList, port,
+ FLOW_PRIORITY_TRANSPORT_EGRESS + 10,
TRANSPORT_EGRESS_NSH_VXGPE_NSC_COOKIE);
sfcOfFlowWriter.writeFlow(flowRspId, sffNodeName, transportEgressFlow);
}
SfcOpenflowUtils.addMatchNshNsc1(match, ipl);
// Copy/Move Nsi, Nsp, Nsc1=>TunIpv4Dst, and Nsc2=>TunId(Vnid)
- int order = 0;
List<Action> actionList = new ArrayList<>();
- actionList.add(SfcOpenflowUtils.createActionNxMoveNshMdtype(order++));
- actionList.add(SfcOpenflowUtils.createActionNxMoveNshNp(order++));
- actionList.add(SfcOpenflowUtils.createActionNxMoveNsi(order++));
- actionList.add(SfcOpenflowUtils.createActionNxMoveNsp(order++));
- actionList.add(SfcOpenflowUtils.createActionNxMoveNsc1ToTunIpv4DstRegister(order++));
- actionList.add(SfcOpenflowUtils.createActionNxMoveNsc2ToTunIdRegister(order++));
+ actionList.add(SfcOpenflowUtils.createActionNxMoveNshMdtype(actionList.size()));
+ actionList.add(SfcOpenflowUtils.createActionNxMoveNshNp(actionList.size()));
+ actionList.add(SfcOpenflowUtils.createActionNxMoveNsi(actionList.size()));
+ actionList.add(SfcOpenflowUtils.createActionNxMoveNsp(actionList.size()));
+ actionList.add(SfcOpenflowUtils.createActionNxMoveNsc1ToTunIpv4DstRegister(actionList.size()));
+ actionList.add(SfcOpenflowUtils.createActionNxMoveNsc2ToTunIdRegister(actionList.size()));
/* Need to set TUN_GPE_NP for VxLAN-gpe port */
- actionList.add(SfcOpenflowUtils.createActionNxLoadTunGpeNp(TUN_GPE_NP_NSH, order++));
+ actionList.add(SfcOpenflowUtils.createActionNxLoadTunGpeNp(OpenflowConstants.TUN_GPE_NP_NSH, actionList.size()));
FlowBuilder transportEgressFlow =
configureTransportEgressFlow(
match, actionList, EMPTY_SWITCH_PORT,
- order, FLOW_PRIORITY_TRANSPORT_EGRESS + 10,
+ FLOW_PRIORITY_TRANSPORT_EGRESS + 10,
TRANSPORT_EGRESS_NSH_VXGPE_APPCOEXIST_COOKIE);
sfcOfFlowWriter.writeFlow(flowRspId, sffNodeName, transportEgressFlow);
}
public void configureNshEthTransportEgressFlow(String sffNodeName, long nshNsp, short nshNsi, String port) {
MatchBuilder match = SfcOpenflowUtils.getNshMatches(nshNsp, nshNsi);
- int order = 0;
List<Action> actionList = new ArrayList<>();
// Copy/Move Nsc1/Nsc2 to the next hop
- actionList.add(SfcOpenflowUtils.createActionNxMoveNsc1(order++));
- actionList.add(SfcOpenflowUtils.createActionNxMoveNsc2(order++));
- actionList.add(SfcOpenflowUtils.createActionNxMoveTunIdRegister(order++));
+ actionList.add(SfcOpenflowUtils.createActionNxMoveNsc1(actionList.size()));
+ actionList.add(SfcOpenflowUtils.createActionNxMoveNsc2(actionList.size()));
+ actionList.add(SfcOpenflowUtils.createActionNxMoveTunIdRegister(actionList.size()));
// TODO need to encap the Ethernet transport
FlowBuilder transportEgressFlow =
configureTransportEgressFlow(
- match, actionList, port, order,
+ match, actionList, port,
FLOW_PRIORITY_TRANSPORT_EGRESS,
TRANSPORT_EGRESS_NSH_ETH_COOKIE);
sfcOfFlowWriter.writeFlow(flowRspId, sffNodeName, transportEgressFlow);
* @param match -already created matches
* @param actionList - a list of actions already created
* @param port - the switch port to send the packet out on
- * @param order - order to use when writing to the actionList
* @param pathId - the RSP path id to match on
* @param srcMac - the source MAC to write to the packet
* @param dstMac - the dest MAC to match against
* @return a FlowBuilder with the created Path Mapper flow
*/
private FlowBuilder configureMacTransportEgressFlow(MatchBuilder match, List<Action> actionList,
- String port, int order, final long pathId, final String srcMac, final String dstMac,
- String cookieStr) {
+ String port, final long pathId, final String srcMac,
+ final String dstMac, String cookieStr) {
//Optionally match on the dstMac
int flowPriority = FLOW_PRIORITY_TRANSPORT_EGRESS;
// Set the macSrc
if (srcMac != null) {
- actionList.add(SfcOpenflowUtils.createActionSetDlSrc(srcMac, order++));
+ actionList.add(SfcOpenflowUtils.createActionSetDlSrc(srcMac, actionList.size()));
}
return configureTransportEgressFlow(
- match, actionList, port, order,
+ match, actionList, port,
flowPriority,
cookieStr);
}
* @param match -already created matches
* @param actionList - a list of actions already created
* @param port - the switch port to send the packet out on
- * @param order - order to use when writing to the actionList
* @param flowPriority - the priority to set on the flow
*
* @return a FlowBuilder with the created Path Mapper flow
*/
private FlowBuilder configureTransportEgressFlow(
- MatchBuilder match, List<Action> actionList, String port, int order, int flowPriority, String cookieStr) {
+ MatchBuilder match, List<Action> actionList, String port, int flowPriority, String cookieStr) {
LOG.debug("SfcProviderSffFlowWriter.ConfigureTransportEgressFlow");
if(port.equals(EMPTY_SWITCH_PORT) && getTableEgress() > APP_COEXISTENCE_NOT_SET) {
// Application Coexistence:
// Instead of egressing the packet out a port, send it to
// a different application pipeline on this same switch
- actionList.add(SfcOpenflowUtils.createActionResubmitTable(getTableEgress(), order++));
+ actionList.add(SfcOpenflowUtils.createActionResubmitTable(getTableEgress(), actionList.size()));
} else {
- actionList.add(SfcOpenflowUtils.createActionOutPort(port, order++));
+ actionList.add(SfcOpenflowUtils.createActionOutPort(port, actionList.size()));
}
InstructionsBuilder isb = SfcOpenflowUtils.wrapActionsIntoApplyActionsInstruction(actionList);
FlowBuilder nextHopFlow =
SfcOpenflowUtils.createFlowBuilder(
getTableId(TABLE_INDEX_NEXT_HOP),
- flowPriority, "nextHop", match, isb);
+ flowPriority, NEXT_HOP_FLOW_NAME_LITERAL, match, isb);
sfcOfFlowWriter.writeFlow(flowRspId, sffNodeName, nextHopFlow);
}
// Make the cookie
BigInteger cookie =
new BigInteger(
- new String(TRANSPORT_EGRESS_COOKIE_STR_BASE + cookieStr),
+ TRANSPORT_EGRESS_COOKIE_STR_BASE + cookieStr,
COOKIE_BIGINT_HEX_RADIX);
FlowBuilder transportEgressFlowBuilder = SfcOpenflowUtils.createFlowBuilder(
import org.mockito.invocation.InvocationOnMock;
import org.mockito.stubbing.Answer;
import org.opendaylight.sfc.ofrenderer.openflow.SfcOfFlowProgrammerImpl;
+import org.opendaylight.sfc.util.openflow.OpenflowConstants;
import org.opendaylight.sfc.util.openflow.transactional_writer.SfcOfFlowWriterInterface;
import org.opendaylight.sfc.util.openflow.SfcOpenflowUtils;
import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.DropActionCase;
private static final short TABLE_BASE = 30;
private static final short TABLE_EGRESS = 80;
- SfcOfFlowWriterInterface sfcOfFlowWriter;
- SfcOfFlowProgrammerImpl sfcOfFlowProgrammer;
- FlowBuilder flowBuilder;
+ private SfcOfFlowWriterInterface sfcOfFlowWriter;
+ private SfcOfFlowProgrammerImpl sfcOfFlowProgrammer;
+ private FlowBuilder flowBuilder;
public SfcOfFlowProgrammerTest() {
this.flowBuilder = null;
/**
* Unit test to check match and action fields from flows generated by:
- * {@link org.opendaylight.sfc.ofrenderer.openflow.SfcOfFlowProgrammerImpl#configureNshVxgpeTransportIngressFlow(String)}
+ * {@link org.opendaylight.sfc.ofrenderer.openflow.SfcOfFlowProgrammerImpl#configureNshVxgpeTransportIngressFlow(String, long, short)}
*/
@Test
public void configureNshVxgpeTransportIngressFlow() {
DstOfArpSpaCase arpSpa = (DstOfArpSpaCase) regMove5.getNxRegMove().getDst().getDstChoice();
assertTrue(regMove.getNxRegMove().getDst().getDstChoice() != null);
- assertEquals(setField.getSetField().getEthernetMatch().getEthernetSource().getAddress().getValue().toString(), MAC_SRC);
+ assertEquals(setField.getSetField().getEthernetMatch().getEthernetSource().getAddress().getValue(), MAC_SRC);
assertEquals(regLoad.getNxRegLoad().getValue().intValue(), SfcOpenflowUtils.ARP_REPLY);
assertTrue(arpSha.isNxArpSha());
assertTrue(arpTha.isNxArpTha());
LOG.info("configureArpTransportIngressFlow() Action ArpOp: [{}], SrcMac: [{}], Output port: [{}]",
regLoad.getNxRegLoad().getValue().intValue(),
- setField.getSetField().getEthernetMatch().getEthernetSource().getAddress().getValue().toString(),
+ setField.getSetField().getEthernetMatch().getEthernetSource().getAddress().getValue(),
output.getOutputAction().getOutputNodeConnector().getValue());
}
assertEquals(match.getProtocolMatchFields().getMplsLabel().longValue(), MPLS_LABEL);
LOG.info("configureMplsPathMapperFlow() Match EtherType: [{}], Mpls Label: [{}]",
match.getEthernetMatch().getEthernetType().getType().getValue(),
- match.getProtocolMatchFields().getMplsLabel().longValue());
+ match.getProtocolMatchFields().getMplsLabel());
//TODO Two test cases for MPLS UCAST/MCAST shall be done
Instructions isb = flowBuilder.getInstructions();
assertEquals(flowBuilder.getPriority().intValue(), SfcOfFlowProgrammerImpl.FLOW_PRIORITY_NEXT_HOP);
Match match = flowBuilder.getMatch();
- assertEquals(match.getEthernetMatch().getEthernetSource().getAddress().getValue().toString(), MAC_SRC);
+ assertEquals(match.getEthernetMatch().getEthernetSource().getAddress().getValue(), MAC_SRC);
assertEquals(match.getMetadata().getMetadata().longValue(), SFP);
LOG.info("configureNextHopFlow() Match SrcMac: [{}], Sfp: [{}]",
- match.getEthernetMatch().getEthernetSource().getAddress().getValue().toString(),
+ match.getEthernetMatch().getEthernetSource().getAddress().getValue(),
match.getMetadata().getMetadata().longValue());
ApplyActionsCase action = (ApplyActionsCase) curInstruction;
SetFieldCase setField = (SetFieldCase) action.getApplyActions().getAction().get(0).getAction();
- assertEquals(setField.getSetField().getEthernetMatch().getEthernetDestination().getAddress().getValue().toString(), MAC_DST);
+ assertEquals(setField.getSetField().getEthernetMatch().getEthernetDestination().getAddress().getValue(), MAC_DST);
LOG.info("configureNextHopFlow() Action Set DstMac: [{}]",
- setField.getSetField().getEthernetMatch().getEthernetDestination().getAddress().getValue().toString());
+ setField.getSetField().getEthernetMatch().getEthernetDestination().getAddress().getValue());
}
checkGoToTable(curInstruction, SfcOfFlowProgrammerImpl.TABLE_INDEX_TRANSPORT_EGRESS);
assertEquals(flowBuilder.getPriority().intValue(), SfcOfFlowProgrammerImpl.FLOW_PRIORITY_NEXT_HOP);
Match match = flowBuilder.getMatch();
- assertEquals(match.getEthernetMatch().getEthernetSource().getAddress().getValue().toString(), MAC_SRC);
+ assertEquals(match.getEthernetMatch().getEthernetSource().getAddress().getValue(), MAC_SRC);
assertEquals(match.getMetadata().getMetadata().longValue(), SFP);
LOG.info("configureGroupNextHopFlow() Match SrcMac: [{}], Sfp: [{}]",
- match.getEthernetMatch().getEthernetSource().getAddress().getValue().toString(),
+ match.getEthernetMatch().getEthernetSource().getAddress().getValue(),
match.getMetadata().getMetadata().longValue());
Instructions isb = flowBuilder.getInstructions();
assertEquals(match.getEthernetMatch().getEthernetDestination().getAddress().getValue(), MAC_DST);
assertEquals(match.getMetadata().getMetadata().longValue(), PATH_ID_SMALL);
LOG.info("configureMacTransportEgressFlow() Match DstMac: [{}], Sfp: [{}]",
- match.getEthernetMatch().getEthernetDestination().getAddress().getValue().toString(),
+ match.getEthernetMatch().getEthernetDestination().getAddress().getValue(),
match.getMetadata().getMetadata().longValue());
Instructions isb = flowBuilder.getInstructions();
assertEquals(dscp.getSetField().getIpMatch().getIpDscp().getValue().shortValue(), PATH_ID_SMALL);
assertEquals(pushVlan.getPushVlanAction().getEthernetType().intValue(), SfcOpenflowUtils.ETHERTYPE_VLAN);
assertEquals(vlanId.getSetField().getVlanMatch().getVlanId().getVlanId().getValue().intValue(), VLAN_ID);
- assertEquals(setField.getSetField().getEthernetMatch().getEthernetSource().getAddress().getValue().toString(), MAC_SRC);
- assertEquals(output.getOutputAction().getOutputNodeConnector().getValue().toString(), PORT);
+ assertEquals(setField.getSetField().getEthernetMatch().getEthernetSource().getAddress().getValue(), MAC_SRC);
+ assertEquals(output.getOutputAction().getOutputNodeConnector().getValue(), PORT);
LOG.info("configureMacTransportEgressFlow() Action SrcMac: [{}], OutputPort: [{}]",
- setField.getSetField().getEthernetMatch().getEthernetSource().getAddress().getValue().toString(),
- output.getOutputAction().getOutputNodeConnector().getValue().toString());
+ setField.getSetField().getEthernetMatch().getEthernetSource().getAddress().getValue(),
+ output.getOutputAction().getOutputNodeConnector().getValue());
}
}
}
assertEquals(vlanId.getSetField().getVlanMatch().getVlanId().getVlanId().getValue().intValue(), VLAN_ID);
assertEquals(output.getOutputAction().getOutputNodeConnector().getValue(), PORT);
LOG.info("configureVlanTransportEgressFlow() Action SrcMac is: [{}], PushVlan Ethertype: [{}], VlanId: [{}], OuputPort: [{}]",
- setField.getSetField().getEthernetMatch().getEthernetSource().getAddress().getValue().toString(),
+ setField.getSetField().getEthernetMatch().getEthernetSource().getAddress().getValue(),
pushVlan.getPushVlanAction().getEthernetType().toString(),
vlanId.getSetField().getVlanMatch().getVlanId().getVlanId().getValue(),
- output.getOutputAction().getOutputNodeConnector().getValue().toString());
+ output.getOutputAction().getOutputNodeConnector().getValue());
}
}
}
flowBuilder = sfcOfFlowWriter.getFlowBuilder();
assertEquals(flowBuilder.getTableId().shortValue(), SfcOfFlowProgrammerImpl.TABLE_INDEX_TRANSPORT_EGRESS);
- int priority = flowBuilder.getPriority().intValue();
+ int priority = flowBuilder.getPriority();
assertTrue((priority == SfcOfFlowProgrammerImpl.FLOW_PRIORITY_TRANSPORT_EGRESS) ||
(priority == SfcOfFlowProgrammerImpl.FLOW_PRIORITY_TRANSPORT_EGRESS+5));
checkMatchNsh(flowBuilder.build(), NSP, NSI);
assertTrue(gpeNp.isNxTunGpeNp());
assertEquals(output.getOutputAction().getOutputNodeConnector().getValue(), PORT);
LOG.info("configureNshVxgpeTransportEgressFlow() Action OutputPort: [{}]",
- output.getOutputAction().getOutputNodeConnector().getValue().toString());
+ output.getOutputAction().getOutputNodeConnector().getValue());
}
}
}
SetFieldCase setField = (SetFieldCase) action.getApplyActions().getAction().get(2).getAction();
OutputActionCase output = (OutputActionCase) action.getApplyActions().getAction().get(3).getAction();
- assertEquals(setField.getSetField().getEthernetMatch().getEthernetSource().getAddress().getValue().toString(), MAC_SRC);
+ assertEquals(setField.getSetField().getEthernetMatch().getEthernetSource().getAddress().getValue(), MAC_SRC);
assertEquals(pushMpls.getPushMplsAction().getEthernetType().intValue(), SfcOpenflowUtils.ETHERTYPE_MPLS_UCAST);
assertEquals(mplsLabel.getSetField().getProtocolMatchFields().getMplsLabel().longValue(), MPLS_LABEL);
assertEquals(output.getOutputAction().getOutputNodeConnector().getValue(), PORT);
LOG.info("configureMplsTransportEgressFlow() Action SrcMac: [{}], PushMplsEthertype: [{}], LabelId: [{}], OutputPort: [{}]",
- setField.getSetField().getEthernetMatch().getEthernetSource().getAddress().getValue().toString(),
+ setField.getSetField().getEthernetMatch().getEthernetSource().getAddress().getValue(),
pushMpls.getPushMplsAction().getEthernetType().toString(),
mplsLabel.getSetField().getProtocolMatchFields().getMplsLabel(),
- output.getOutputAction().getOutputNodeConnector().getValue().toString());
+ output.getOutputAction().getOutputNodeConnector().getValue());
}
}
}
if (curInstruction instanceof ApplyActionsCase) {
ApplyActionsCase action = (ApplyActionsCase) curInstruction;
- OutputActionCase output = (OutputActionCase) action.getApplyActions().getAction().get(0).getAction();
+ assertEquals(2, action.getApplyActions().getAction().size());
+ NxActionRegLoadNodesNodeTableFlowApplyActionsCase loadNextProtocol =
+ (NxActionRegLoadNodesNodeTableFlowApplyActionsCase) action.getApplyActions().getAction().get(0).getAction();
+ OutputActionCase output = (OutputActionCase) action.getApplyActions().getAction().get(1).getAction();
+ assertEquals(Short.toString(OpenflowConstants.TUN_GPE_NP_NSH), loadNextProtocol.getNxRegLoad().getValue().toString());
assertEquals(output.getOutputAction().getOutputNodeConnector().getValue(), PORT);
LOG.info("configureNshNscTransportEgressFlow() Action OutputPort is: [{}]",
- output.getOutputAction().getOutputNodeConnector().getValue().toString());
+ output.getOutputAction().getOutputNodeConnector().getValue());
}
}
}
public void appCoexistencePathMapperAcl() {
sfcOfFlowProgrammer.setTableBase(TABLE_BASE);
sfcOfFlowProgrammer.setTableEgress(TABLE_EGRESS);
- ((SfcOfFlowProgrammerImpl) sfcOfFlowProgrammer).configurePathMapperAclFlow(SFF_NAME, IP_SRC, IP_DST, (short) PATH_ID);
+ sfcOfFlowProgrammer.configurePathMapperAclFlow(SFF_NAME, IP_SRC, IP_DST, (short) PATH_ID);
flowBuilder = sfcOfFlowWriter.getFlowBuilder();
assertEquals(flowBuilder.getTableId().shortValue(),
SfcOfFlowProgrammerImpl.TABLE_INDEX_PATH_MAPPER_ACL + TABLE_BASE - 2);
checkGoToTable(curInstruction, (short)(SfcOfFlowProgrammerImpl.TABLE_INDEX_NEXT_HOP + TABLE_BASE - 2), true);
}
- public void checkGoToTable(Instruction curInstruction, short nextTableId) {
+ private void checkGoToTable(Instruction curInstruction, short nextTableId) {
checkGoToTable(curInstruction, nextTableId, false);
}
- public void checkGoToTable(Instruction curInstruction, short nextTableId, boolean mustExist) {
+ private void checkGoToTable(Instruction curInstruction, short nextTableId, boolean mustExist) {
if (curInstruction instanceof GoToTableCase) {
GoToTableCase goToTablecase = (GoToTableCase) curInstruction;
}
}
- public void checkActionHasResubmit(Instruction curInstruction, short nextTableId) {
+ private void checkActionHasResubmit(Instruction curInstruction, short nextTableId) {
assertTrue(curInstruction instanceof ApplyActionsCase);
boolean resubmitActionFound = false;
for(Action action : ((ApplyActionsCase) curInstruction).getApplyActions().getAction()){
assertTrue(resubmitActionFound);
}
- public void checkDrop(Instruction curInstruction) {
- checkDrop(curInstruction, false);
- }
-
- public void checkDrop(Instruction curInstruction, boolean mustExist) {
+ private void checkDrop(Instruction curInstruction, boolean mustExist) {
if (curInstruction instanceof ApplyActionsCase) {
ApplyActionsCase action = (ApplyActionsCase) curInstruction;
}
}
- public void checkMetadata(Instruction curInstruction, long pathId) {
+ private void checkMetadata(Instruction curInstruction, long pathId) {
if (curInstruction instanceof WriteMetadataCase) {
WriteMetadataCase metadata = (WriteMetadataCase) curInstruction;
}
}
- public void checkMatchNsh(Flow flow, long nsp, short nsi) {
+ private void checkMatchNsh(Flow flow, long nsp, short nsi) {
GeneralAugMatchNodesNodeTableFlow genAug = flow.getMatch().getAugmentation(
GeneralAugMatchNodesNodeTableFlow.class);