Jian Li
Committed by Gerrit Code Review

Try to use ModMplsHeaderInstruction and ModVlanHeaderInstruction

Change-Id: I0b486907ef718a6dfa3e92696397fe5a7e851aed
......@@ -333,7 +333,7 @@ public final class Instructions {
* @return a L2 modification.
*/
public static Instruction pushMpls() {
return new L2ModificationInstruction.PushHeaderInstructions(
return new L2ModificationInstruction.ModMplsHeaderInstruction(
L2ModificationInstruction.L2SubType.MPLS_PUSH,
EthType.EtherType.MPLS_UNICAST.ethType());
}
......@@ -344,7 +344,7 @@ public final class Instructions {
* @return a L2 modification.
*/
public static Instruction popMpls() {
return new L2ModificationInstruction.PushHeaderInstructions(
return new L2ModificationInstruction.ModMplsHeaderInstruction(
L2ModificationInstruction.L2SubType.MPLS_POP,
EthType.EtherType.MPLS_UNICAST.ethType());
}
......@@ -357,7 +357,7 @@ public final class Instructions {
*/
public static Instruction popMpls(EthType etherType) {
checkNotNull(etherType, "Ethernet type cannot be null");
return new L2ModificationInstruction.PushHeaderInstructions(
return new L2ModificationInstruction.ModMplsHeaderInstruction(
L2ModificationInstruction.L2SubType.MPLS_POP, etherType);
}
......@@ -367,7 +367,7 @@ public final class Instructions {
* @return a L2 modification
*/
public static Instruction popVlan() {
return new L2ModificationInstruction.PopVlanInstruction(
return new L2ModificationInstruction.ModVlanHeaderInstruction(
L2ModificationInstruction.L2SubType.VLAN_POP);
}
......@@ -377,7 +377,7 @@ public final class Instructions {
* @return a L2 modification
*/
public static Instruction pushVlan() {
return new L2ModificationInstruction.PushHeaderInstructions(
return new L2ModificationInstruction.ModVlanHeaderInstruction(
L2ModificationInstruction.L2SubType.VLAN_PUSH,
EthType.EtherType.VLAN.ethType());
}
......
......@@ -15,8 +15,7 @@
*/
package org.onosproject.net.flow.instructions;
import java.util.List;
import com.google.common.testing.EqualsTester;
import org.junit.Test;
import org.onlab.packet.EthType;
import org.onlab.packet.IpAddress;
......@@ -34,7 +33,7 @@ import org.onosproject.net.OduSignalId;
import org.onosproject.net.PortNumber;
import org.onosproject.net.meter.MeterId;
import com.google.common.testing.EqualsTester;
import java.util.List;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.equalTo;
......@@ -106,11 +105,10 @@ public class InstructionsTest {
assertThatClassIsImmutable(L2ModificationInstruction.ModEtherInstruction.class);
assertThatClassIsImmutable(L2ModificationInstruction.ModVlanIdInstruction.class);
assertThatClassIsImmutable(L2ModificationInstruction.ModVlanPcpInstruction.class);
assertThatClassIsImmutable(L2ModificationInstruction.PopVlanInstruction.class);
assertThatClassIsImmutable(L3ModificationInstruction.ModIPInstruction.class);
assertThatClassIsImmutable(L3ModificationInstruction.ModIPv6FlowLabelInstruction.class);
assertThatClassIsImmutable(L2ModificationInstruction.ModMplsLabelInstruction.class);
assertThatClassIsImmutable(L2ModificationInstruction.PushHeaderInstructions.class);
assertThatClassIsImmutable(L2ModificationInstruction.ModMplsHeaderInstruction.class);
assertThatClassIsImmutable(L2ModificationInstruction.ModMplsBosInstruction.class);
assertThatClassIsImmutable(L2ModificationInstruction.ModMplsTtlInstruction.class);
assertThatClassIsImmutable(L2ModificationInstruction.ModTunnelIdInstruction.class);
......@@ -970,13 +968,13 @@ public class InstructionsTest {
extensionInstruction2);
}
// PushHeaderInstructions
// ModMplsHeaderInstructions
private final EthType ethType1 = new EthType(1);
private final EthType ethType2 = new EthType(2);
private final Instruction pushHeaderInstruction1 = Instructions.popMpls(ethType1);
private final Instruction sameAsPushHeaderInstruction1 = Instructions.popMpls(ethType1);
private final Instruction pushHeaderInstruction2 = Instructions.popMpls(ethType2);
private final Instruction modMplsHeaderInstruction1 = Instructions.popMpls(ethType1);
private final Instruction sameAsModMplsHeaderInstruction1 = Instructions.popMpls(ethType1);
private final Instruction modMplsHeaderInstruction2 = Instructions.popMpls(ethType2);
/**
* Test the pushMpls method.
......@@ -984,10 +982,10 @@ public class InstructionsTest {
@Test
public void testPushMplsMethod() {
final Instruction instruction = Instructions.pushMpls();
final L2ModificationInstruction.PushHeaderInstructions pushHeaderInstruction =
final L2ModificationInstruction.ModMplsHeaderInstruction pushHeaderInstruction =
checkAndConvert(instruction,
Instruction.Type.L2MODIFICATION,
L2ModificationInstruction.PushHeaderInstructions.class);
L2ModificationInstruction.ModMplsHeaderInstruction.class);
assertThat(pushHeaderInstruction.ethernetType().toString(),
is(EthType.EtherType.MPLS_MULTICAST.toString()));
assertThat(pushHeaderInstruction.subtype(),
......@@ -1000,10 +998,10 @@ public class InstructionsTest {
@Test
public void testPopMplsMethod() {
final Instruction instruction = Instructions.popMpls();
final L2ModificationInstruction.PushHeaderInstructions pushHeaderInstruction =
final L2ModificationInstruction.ModMplsHeaderInstruction pushHeaderInstruction =
checkAndConvert(instruction,
Instruction.Type.L2MODIFICATION,
L2ModificationInstruction.PushHeaderInstructions.class);
L2ModificationInstruction.ModMplsHeaderInstruction.class);
assertThat(pushHeaderInstruction.ethernetType().toString(),
is(EthType.EtherType.MPLS_MULTICAST.toString()));
assertThat(pushHeaderInstruction.subtype(),
......@@ -1016,10 +1014,10 @@ public class InstructionsTest {
@Test
public void testPopMplsEthertypeMethod() {
final Instruction instruction = Instructions.popMpls(new EthType(1));
final L2ModificationInstruction.PushHeaderInstructions pushHeaderInstruction =
final L2ModificationInstruction.ModMplsHeaderInstruction pushHeaderInstruction =
checkAndConvert(instruction,
Instruction.Type.L2MODIFICATION,
L2ModificationInstruction.PushHeaderInstructions.class);
L2ModificationInstruction.ModMplsHeaderInstruction.class);
assertThat(pushHeaderInstruction.ethernetType().toShort(), is((short) 1));
assertThat(pushHeaderInstruction.subtype(),
is(L2ModificationInstruction.L2SubType.MPLS_POP));
......@@ -1031,10 +1029,10 @@ public class InstructionsTest {
@Test
public void testPushVlanMethod() {
final Instruction instruction = Instructions.pushVlan();
final L2ModificationInstruction.PushHeaderInstructions pushHeaderInstruction =
final L2ModificationInstruction.ModVlanHeaderInstruction pushHeaderInstruction =
checkAndConvert(instruction,
Instruction.Type.L2MODIFICATION,
L2ModificationInstruction.PushHeaderInstructions.class);
L2ModificationInstruction.ModVlanHeaderInstruction.class);
assertThat(pushHeaderInstruction.ethernetType().toString(),
is(EthType.EtherType.VLAN.toString()));
assertThat(pushHeaderInstruction.subtype(),
......@@ -1043,14 +1041,14 @@ public class InstructionsTest {
/**
* Tests the equals(), hashCode() and toString() methods of the
* PushHeaderInstructions class.
* ModMplsHeaderInstructions class.
*/
@Test
public void testPushHeaderInstructionsEquals() {
checkEqualsAndToString(pushHeaderInstruction1,
sameAsPushHeaderInstruction1,
pushHeaderInstruction2);
public void testModMplsHeaderInstructionsEquals() {
checkEqualsAndToString(modMplsHeaderInstruction1,
sameAsModMplsHeaderInstruction1,
modMplsHeaderInstruction2);
}
// ModMplsTtlInstruction
......@@ -1074,7 +1072,7 @@ public class InstructionsTest {
/**
* Tests the equals(), hashCode() and toString() methods of the
* PushHeaderInstructions class.
* ModMplsTtlInstructions class.
*/
@Test
......@@ -1107,7 +1105,7 @@ public class InstructionsTest {
/**
* Tests the equals(), hashCode() and toString() methods of the
* PushHeaderInstructions class.
* ModMplsBosInstructions class.
*/
@Test
......@@ -1117,10 +1115,10 @@ public class InstructionsTest {
modMplsBosInstruction2);
}
// PopVlanInstruction
// ModVlanHeaderInstruction
private final Instruction popVlanInstruction1 = Instructions.popVlan();
private final Instruction sameAsPopVlanInstruction1 = Instructions.popVlan();
private final Instruction modVlanHeaderInstruction1 = Instructions.popVlan();
private final Instruction sameAsModVlanHeaderInstruction1 = Instructions.popVlan();
/**
* Test the popVlan method.
......@@ -1128,23 +1126,23 @@ public class InstructionsTest {
@Test
public void testPopVlanMethod() {
final Instruction instruction = Instructions.popVlan();
final L2ModificationInstruction.PopVlanInstruction popVlanInstruction =
final L2ModificationInstruction.ModVlanHeaderInstruction popVlanInstruction =
checkAndConvert(instruction,
Instruction.Type.L2MODIFICATION,
L2ModificationInstruction.PopVlanInstruction.class);
L2ModificationInstruction.ModVlanHeaderInstruction.class);
assertThat(popVlanInstruction.subtype(),
is(L2ModificationInstruction.L2SubType.VLAN_POP));
}
/**
* Tests the equals(), hashCode() and toString() methods of the
* PushHeaderInstructions class.
* ModVlanHeaderInstructions class.
*/
@Test
public void testPopVlanInstructionsEquals() {
public void testModVlanHeaderInstructionsEquals() {
new EqualsTester()
.addEqualityGroup(popVlanInstruction1, sameAsPopVlanInstruction1)
.addEqualityGroup(modVlanHeaderInstruction1, sameAsModVlanHeaderInstruction1)
.testEquals();
}
......
......@@ -142,9 +142,8 @@ public final class EncodeInstructionCodecHelper {
result.put(InstructionCodec.MPLS_LABEL, modMplsLabelInstruction.label().toInt());
break;
case MPLS_PUSH:
final L2ModificationInstruction.PushHeaderInstructions pushHeaderInstructions =
(L2ModificationInstruction.PushHeaderInstructions) l2Instruction;
final L2ModificationInstruction.ModMplsHeaderInstruction pushHeaderInstructions =
(L2ModificationInstruction.ModMplsHeaderInstruction) l2Instruction;
result.put(InstructionCodec.ETHERNET_TYPE,
pushHeaderInstructions.ethernetType().toShort());
break;
......
......@@ -425,14 +425,14 @@ public class FlowRuleCodecTest {
instruction = getInstruction(Instruction.Type.L2MODIFICATION,
L2ModificationInstruction.L2SubType.MPLS_PUSH.name());
assertThat(instruction.type(), is(Instruction.Type.L2MODIFICATION));
assertThat(((L2ModificationInstruction.PushHeaderInstructions) instruction)
assertThat(((L2ModificationInstruction.ModMplsHeaderInstruction) instruction)
.ethernetType().toShort(),
is(Ethernet.MPLS_UNICAST));
instruction = getInstruction(Instruction.Type.L2MODIFICATION,
L2ModificationInstruction.L2SubType.MPLS_POP.name());
assertThat(instruction.type(), is(Instruction.Type.L2MODIFICATION));
assertThat(((L2ModificationInstruction.PushHeaderInstructions) instruction)
assertThat(((L2ModificationInstruction.ModMplsHeaderInstruction) instruction)
.ethernetType().toShort(),
is(Ethernet.MPLS_UNICAST));
......@@ -444,12 +444,12 @@ public class FlowRuleCodecTest {
instruction = getInstruction(Instruction.Type.L2MODIFICATION,
L2ModificationInstruction.L2SubType.VLAN_POP.name());
assertThat(instruction.type(), is(Instruction.Type.L2MODIFICATION));
assertThat(instruction, instanceOf(L2ModificationInstruction.PopVlanInstruction.class));
assertThat(instruction, instanceOf(L2ModificationInstruction.ModVlanHeaderInstruction.class));
instruction = getInstruction(Instruction.Type.L2MODIFICATION,
L2ModificationInstruction.L2SubType.VLAN_PUSH.name());
assertThat(instruction.type(), is(Instruction.Type.L2MODIFICATION));
assertThat(instruction, instanceOf(L2ModificationInstruction.PushHeaderInstructions.class));
assertThat(instruction, instanceOf(L2ModificationInstruction.ModVlanHeaderInstruction.class));
instruction = getInstruction(Instruction.Type.L2MODIFICATION,
L2ModificationInstruction.L2SubType.TUNNEL_ID.name());
......
......@@ -15,10 +15,7 @@
*/
package org.onosproject.codec.impl;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.notNullValue;
import static org.onosproject.codec.impl.InstructionJsonMatcher.matchesInstruction;
import com.fasterxml.jackson.databind.node.ObjectNode;
import org.junit.Before;
import org.junit.Test;
import org.onlab.packet.Ip4Address;
......@@ -40,7 +37,9 @@ import org.onosproject.net.flow.instructions.L1ModificationInstruction;
import org.onosproject.net.flow.instructions.L2ModificationInstruction;
import org.onosproject.net.flow.instructions.L3ModificationInstruction;
import com.fasterxml.jackson.databind.node.ObjectNode;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.notNullValue;
import static org.onosproject.codec.impl.InstructionJsonMatcher.matchesInstruction;
/**
* Unit tests for Instruction codec.
......@@ -60,12 +59,12 @@ public class InstructionCodecTest {
}
/**
* Tests the encoding of push header instructions.
* Tests the encoding of push mpls header instructions.
*/
@Test
public void pushHeaderInstructionsTest() {
final L2ModificationInstruction.PushHeaderInstructions instruction =
(L2ModificationInstruction.PushHeaderInstructions) Instructions.pushMpls();
final L2ModificationInstruction.ModMplsHeaderInstruction instruction =
(L2ModificationInstruction.ModMplsHeaderInstruction) Instructions.pushMpls();
final ObjectNode instructionJson = instructionCodec.encode(instruction, context);
assertThat(instructionJson, matchesInstruction(instruction));
......
......@@ -29,10 +29,10 @@ import org.onosproject.net.flow.instructions.Instructions.SetQueueInstruction;
import org.onosproject.net.flow.instructions.L0ModificationInstruction.ModOchSignalInstruction;
import org.onosproject.net.flow.instructions.L1ModificationInstruction.ModOduSignalIdInstruction;
import org.onosproject.net.flow.instructions.L2ModificationInstruction.ModEtherInstruction;
import org.onosproject.net.flow.instructions.L2ModificationInstruction.ModMplsHeaderInstruction;
import org.onosproject.net.flow.instructions.L2ModificationInstruction.ModMplsLabelInstruction;
import org.onosproject.net.flow.instructions.L2ModificationInstruction.ModVlanIdInstruction;
import org.onosproject.net.flow.instructions.L2ModificationInstruction.ModVlanPcpInstruction;
import org.onosproject.net.flow.instructions.L2ModificationInstruction.PushHeaderInstructions;
import org.onosproject.net.flow.instructions.L3ModificationInstruction.ModIPInstruction;
import org.onosproject.net.flow.instructions.L3ModificationInstruction.ModIPv6FlowLabelInstruction;
......@@ -54,10 +54,10 @@ public final class InstructionJsonMatcher extends TypeSafeDiagnosingMatcher<Json
* @param description Description object used for recording errors
* @return true if contents match, false otherwise
*/
private boolean matchPushHeaderInstruction(JsonNode instructionJson,
Description description) {
PushHeaderInstructions instructionToMatch =
(PushHeaderInstructions) instruction;
private boolean matchModMplsHeaderInstruction(JsonNode instructionJson,
Description description) {
ModMplsHeaderInstruction instructionToMatch =
(ModMplsHeaderInstruction) instruction;
final String jsonSubtype = instructionJson.get("subtype").textValue();
if (!instructionToMatch.subtype().name().equals(jsonSubtype)) {
description.appendText("subtype was " + jsonSubtype);
......@@ -84,6 +84,8 @@ public final class InstructionJsonMatcher extends TypeSafeDiagnosingMatcher<Json
return true;
}
// TODO: need to add matchModVlanHeaderInstruction
/**
* Matches the contents of an output instruction.
*
......@@ -513,8 +515,8 @@ public final class InstructionJsonMatcher extends TypeSafeDiagnosingMatcher<Json
return false;
}
if (instruction instanceof PushHeaderInstructions) {
return matchPushHeaderInstruction(jsonInstruction, description);
if (instruction instanceof ModMplsHeaderInstruction) {
return matchModMplsHeaderInstruction(jsonInstruction, description);
} else if (instruction instanceof OutputInstruction) {
return matchOutputInstruction(jsonInstruction, description);
} else if (instruction instanceof GroupInstruction) {
......
......@@ -15,16 +15,8 @@
*/
package org.onosproject.net.intent.impl.compiler;
import java.util.Collections;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.Set;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.Sets;
import org.onlab.packet.EthType;
import org.onlab.packet.Ethernet;
import org.onlab.packet.MplsLabel;
......@@ -52,8 +44,15 @@ import org.onosproject.net.resource.ResourceService;
import org.onosproject.net.resource.Resources;
import org.slf4j.Logger;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.Sets;
import java.util.Collections;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.Set;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import static org.onosproject.net.LinkKey.linkKey;
......@@ -214,10 +213,11 @@ public class PathCompiler<T> {
instruction -> instruction instanceof L2ModificationInstruction.ModVlanIdInstruction)
.map(x -> (L2ModificationInstruction.ModVlanIdInstruction) x).findAny();
Optional<L2ModificationInstruction.PopVlanInstruction> popVlanInstruction = intent.treatment()
Optional<L2ModificationInstruction.ModVlanHeaderInstruction> popVlanInstruction = intent.treatment()
.allInstructions().stream().filter(
instruction -> instruction instanceof L2ModificationInstruction.PopVlanInstruction)
.map(x -> (L2ModificationInstruction.PopVlanInstruction) x).findAny();
instruction -> instruction instanceof
L2ModificationInstruction.ModVlanHeaderInstruction)
.map(x -> (L2ModificationInstruction.ModVlanHeaderInstruction) x).findAny();
if (!modVlanIdInstruction.isPresent() && !popVlanInstruction.isPresent()) {
if (vlanCriterion.isPresent()) {
......
......@@ -317,7 +317,7 @@ public class PathIntentCompilerTest {
.collect(Collectors.toSet()), hasSize(1));
assertThat(vlanMod.iterator().next().vlanId(), is(egressVlan));
assertThat(rule3.treatment().allInstructions().stream()
.filter(treat -> treat instanceof L2ModificationInstruction.PopVlanInstruction)
.filter(treat -> treat instanceof L2ModificationInstruction.ModVlanHeaderInstruction)
.collect(Collectors.toSet()), hasSize(0));
sut.deactivate();
......@@ -350,7 +350,7 @@ public class PathIntentCompilerTest {
.filter(treat -> treat instanceof L2ModificationInstruction.ModVlanIdInstruction)
.collect(Collectors.toSet()), hasSize(0));
assertThat(trafficTreatment.allInstructions().stream()
.filter(treat -> treat instanceof L2ModificationInstruction.PopVlanInstruction)
.filter(treat -> treat instanceof L2ModificationInstruction.ModVlanHeaderInstruction)
.collect(Collectors.toSet()), hasSize(1));
}
......@@ -436,7 +436,7 @@ public class PathIntentCompilerTest {
.filter(treat -> treat instanceof L2ModificationInstruction.ModMplsLabelInstruction)
.collect(Collectors.toSet()), hasSize(0));
assertThat(trafficTreatment.allInstructions().stream()
.filter(treat -> treat instanceof L2ModificationInstruction.PushHeaderInstructions)
.filter(treat -> treat instanceof L2ModificationInstruction.ModMplsHeaderInstruction)
.collect(Collectors.toSet()), hasSize(1));
}
......
......@@ -189,6 +189,10 @@ import org.onosproject.net.intent.constraint.PartialFailureConstraint;
import org.onosproject.net.intent.constraint.WaypointConstraint;
import org.onosproject.net.link.DefaultLinkDescription;
import org.onosproject.net.meter.MeterId;
import org.onosproject.net.packet.DefaultOutboundPacket;
import org.onosproject.net.packet.DefaultPacketRequest;
import org.onosproject.net.packet.PacketPriority;
import org.onosproject.net.provider.ProviderId;
import org.onosproject.net.resource.ContinuousResource;
import org.onosproject.net.resource.ContinuousResourceId;
import org.onosproject.net.resource.DiscreteResource;
......@@ -196,10 +200,6 @@ import org.onosproject.net.resource.DiscreteResourceCodec;
import org.onosproject.net.resource.DiscreteResourceId;
import org.onosproject.net.resource.ResourceAllocation;
import org.onosproject.net.resource.ResourceConsumerId;
import org.onosproject.net.packet.DefaultOutboundPacket;
import org.onosproject.net.packet.DefaultPacketRequest;
import org.onosproject.net.packet.PacketPriority;
import org.onosproject.net.provider.ProviderId;
import org.onosproject.security.Permission;
import org.onosproject.store.Timestamp;
import org.onosproject.store.primitives.MapUpdate;
......@@ -399,9 +399,11 @@ public final class KryoNamespaces {
L2ModificationInstruction.L2SubType.class,
L2ModificationInstruction.ModEtherInstruction.class,
L2ModificationInstruction.PushHeaderInstructions.class,
L2ModificationInstruction.PopVlanInstruction.class,
L2ModificationInstruction.ModMplsHeaderInstruction.class,
L2ModificationInstruction.ModVlanIdInstruction.class,
L2ModificationInstruction.ModVlanPcpInstruction.class,
L2ModificationInstruction.PopVlanInstruction.class,
L2ModificationInstruction.ModVlanHeaderInstruction.class,
L2ModificationInstruction.ModMplsLabelInstruction.class,
L2ModificationInstruction.ModMplsBosInstruction.class,
L2ModificationInstruction.ModMplsTtlInstruction.class,
......
......@@ -40,11 +40,12 @@ import org.onosproject.net.flow.instructions.L1ModificationInstruction.ModOduSig
import org.onosproject.net.flow.instructions.L2ModificationInstruction;
import org.onosproject.net.flow.instructions.L2ModificationInstruction.ModEtherInstruction;
import org.onosproject.net.flow.instructions.L2ModificationInstruction.ModMplsBosInstruction;
import org.onosproject.net.flow.instructions.L2ModificationInstruction.ModMplsHeaderInstruction;
import org.onosproject.net.flow.instructions.L2ModificationInstruction.ModMplsLabelInstruction;
import org.onosproject.net.flow.instructions.L2ModificationInstruction.ModTunnelIdInstruction;
import org.onosproject.net.flow.instructions.L2ModificationInstruction.ModVlanHeaderInstruction;
import org.onosproject.net.flow.instructions.L2ModificationInstruction.ModVlanIdInstruction;
import org.onosproject.net.flow.instructions.L2ModificationInstruction.ModVlanPcpInstruction;
import org.onosproject.net.flow.instructions.L2ModificationInstruction.PushHeaderInstructions;
import org.onosproject.net.flow.instructions.L3ModificationInstruction;
import org.onosproject.net.flow.instructions.L3ModificationInstruction.ModArpEthInstruction;
import org.onosproject.net.flow.instructions.L3ModificationInstruction.ModArpIPInstruction;
......@@ -394,13 +395,13 @@ public class FlowModBuilderVer13 extends FlowModBuilder {
oxm = factory().oxms().vlanPcp(VlanPcp.of(vlanPcp.vlanPcp()));
break;
case MPLS_PUSH:
PushHeaderInstructions pushHeaderInstructions =
(PushHeaderInstructions) l2m;
ModMplsHeaderInstruction pushHeaderInstructions =
(ModMplsHeaderInstruction) l2m;
return factory().actions().pushMpls(EthType.of(pushHeaderInstructions
.ethernetType().toShort()));
case MPLS_POP:
PushHeaderInstructions popHeaderInstructions =
(PushHeaderInstructions) l2m;
ModMplsHeaderInstruction popHeaderInstructions =
(ModMplsHeaderInstruction) l2m;
return factory().actions().popMpls(EthType.of(popHeaderInstructions
.ethernetType().toShort()));
case MPLS_LABEL:
......@@ -419,7 +420,7 @@ public class FlowModBuilderVer13 extends FlowModBuilder {
case VLAN_POP:
return factory().actions().popVlan();
case VLAN_PUSH:
PushHeaderInstructions pushVlanInstruction = (PushHeaderInstructions) l2m;
ModVlanHeaderInstruction pushVlanInstruction = (ModVlanHeaderInstruction) l2m;
return factory().actions().pushVlan(
EthType.of(pushVlanInstruction.ethernetType().toShort()));
case TUNNEL_ID:
......
......@@ -15,14 +15,6 @@
*/
package org.onosproject.provider.of.group.impl;
import static org.slf4j.LoggerFactory.getLogger;
import java.util.ArrayList;
import java.util.Collections;
import java.util.LinkedList;
import java.util.List;
import java.util.Optional;
import org.onlab.packet.Ip4Address;
import org.onlab.packet.Ip6Address;
import org.onosproject.core.GroupId;
......@@ -67,6 +59,14 @@ import org.projectfloodlight.openflow.types.U64;
import org.projectfloodlight.openflow.types.VlanPcp;
import org.slf4j.Logger;
import java.util.ArrayList;
import java.util.Collections;
import java.util.LinkedList;
import java.util.List;
import java.util.Optional;
import static org.slf4j.LoggerFactory.getLogger;
/*
* Builder for GroupMod.
*/
......@@ -319,18 +319,18 @@ public final class GroupModBuilder {
case VLAN_POP:
return factory.actions().popVlan();
case VLAN_PUSH:
L2ModificationInstruction.PushHeaderInstructions pushVlanInstruction
= (L2ModificationInstruction.PushHeaderInstructions) l2m;
L2ModificationInstruction.ModVlanHeaderInstruction pushVlanInstruction
= (L2ModificationInstruction.ModVlanHeaderInstruction) l2m;
return factory.actions().pushVlan(
EthType.of(pushVlanInstruction.ethernetType().toShort()));
case MPLS_PUSH:
L2ModificationInstruction.PushHeaderInstructions pushHeaderInstructions =
(L2ModificationInstruction.PushHeaderInstructions) l2m;
L2ModificationInstruction.ModMplsHeaderInstruction pushHeaderInstructions =
(L2ModificationInstruction.ModMplsHeaderInstruction) l2m;
return factory.actions().pushMpls(EthType.of(pushHeaderInstructions
.ethernetType().toShort()));
case MPLS_POP:
L2ModificationInstruction.PushHeaderInstructions popHeaderInstructions =
(L2ModificationInstruction.PushHeaderInstructions) l2m;
L2ModificationInstruction.ModMplsHeaderInstruction popHeaderInstructions =
(L2ModificationInstruction.ModMplsHeaderInstruction) l2m;
return factory.actions().popMpls(EthType.of(popHeaderInstructions
.ethernetType().toShort()));
case MPLS_LABEL:
......