+ /**
+ * Test method for {@link MDFlowMapping#toAction(Action, int)}.
+ */
+ @Test
+ public void testToAction() {
+ // PUSH_VLAN test.
+ EtherTypes[] tags = {EtherTypes.VLANTAGGED, EtherTypes.QINQ};
+ int order = 0;
+ for (EtherTypes tag: tags) {
+ Action action = new PushVlan(tag);
+ org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.
+ rev131112.action.list.Action mdActionList =
+ MDFlowMapping.toAction(action, order);
+ Assert.assertEquals(order, mdActionList.getOrder().intValue());
+
+ org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.
+ rev131112.action.Action mdAction = mdActionList.getAction();
+ Assert.assertTrue(mdAction instanceof PushVlanActionCase);
+ PushVlanActionCase pushVlan = (PushVlanActionCase)mdAction;
+ Assert.assertEquals(tag.intValue(),
+ pushVlan.getPushVlanAction().getEthernetType().
+ intValue());
+ order++;
+ }
+ }