X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=opendaylight%2Fsal%2Fapi%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fsal%2Faction%2FPushVlan.java;h=a1b50edd5116fcc8a451d86ae2dff61d5f2b643e;hb=edf5bfcee83c750853253ccfd991ba7000f5f65b;hp=edb30ae031ac25f344b447aa83a6344c3f0965c6;hpb=cc5814b25b247f5ffe0c17ede1850e71ca06eee6;p=controller.git diff --git a/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/action/PushVlan.java b/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/action/PushVlan.java index edb30ae031..a1b50edd51 100644 --- a/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/action/PushVlan.java +++ b/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/action/PushVlan.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved. + * Copyright (c) 2013-2014 Cisco Systems, Inc. and others. All rights reserved. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v1.0 which accompanies this distribution, @@ -59,6 +59,32 @@ public class PushVlan extends Action { runChecks(); } + /** + * Construct a new action instance which represents OF 1.3 PUSH_VLAN. + * + * @param tag An {@link EtherTypes} instance. + */ + public PushVlan(EtherTypes tag) { + this(tag.intValue()); + } + + /** + * Construct a new action instance which represents OF 1.3 PUSH_VLAN. + * + * @param tag An ethernet type of a new VLAN tag. + */ + public PushVlan(int tag) { + type = ActionType.PUSH_VLAN; + this.tag = tag; + + if (tag != EtherTypes.VLANTAGGED.intValue() && + tag != EtherTypes.QINQ.intValue()) { + // pass a value which will tell fail and tell something about the + // original wrong value + checkValue(ActionType.SET_DL_TYPE, 0xBAD << 16 | tag); + } + } + private int createTci() { return (pcp & 0x7) << 13 | (cfi & 0x1) << 12 | (vlanId & 0xfff); }