use of org.projectfloodlight.openflow.protocol.action.OFActions in project open-kilda by telstra.
the class SwitchManager method actionSetDstMac.
/**
* Create an action to set the DstMac of a packet
*
* @param sw switch object
* @param macAddress MacAddress to set
* @return {@link OFAction}
*/
private OFAction actionSetDstMac(final IOFSwitch sw, final MacAddress macAddress) {
OFOxms oxms = sw.getOFFactory().oxms();
OFActions actions = sw.getOFFactory().actions();
return actions.buildSetField().setField(oxms.buildEthDst().setValue(macAddress).build()).build();
}
use of org.projectfloodlight.openflow.protocol.action.OFActions in project open-kilda by telstra.
the class SwitchManager method actionReplaceVlan.
/**
* Create an OFAction to change the outer most vlan.
*
* @param sw switch object
* @param newVlan final VLAN to be set on the packet
* @return {@link OFAction}
*/
private OFAction actionReplaceVlan(final IOFSwitch sw, final int newVlan) {
OFFactory factory = sw.getOFFactory();
OFOxms oxms = factory.oxms();
OFActions actions = factory.actions();
if (OF_12.compareTo(factory.getVersion()) == 0) {
return actions.buildSetField().setField(oxms.buildVlanVid().setValue(OFVlanVidMatch.ofRawVid((short) newVlan)).build()).build();
} else {
return actions.buildSetField().setField(oxms.buildVlanVid().setValue(OFVlanVidMatch.ofVlan(newVlan)).build()).build();
}
}