Ask Your Question
0

Pop Vlan tag

asked 2015-07-28 02:15:15 -0700

tmtuan gravatar image

updated 2015-07-28 02:59:43 -0700

Hi all,

How can I pop Vlan tag by Restful API? I use the following xml script. Although I can receive response code 200, there no any flow entries inserted to switches.

Thank you!

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<flow xmlns="urn:opendaylight:flow:inventory">
    <strict>false</strict>
    <instructions>
        <instruction>
            <order>0</order>
            <apply-actions>
                <action>
                    <order>0</order>
                    <pop-vlan-action/>
                </action>
            </apply-actions>
        </instruction>
    </instructions>
    <table_id>2</table_id>
    <id>152</id>
    <cookie_mask>10</cookie_mask>
    <installHw>false</installHw>
    <out_group>2</out_group>
    <match>
        <ethernet-match>
            <ethernet-type>
                <type>2048</type>
            </ethernet-type>
        </ethernet-match>
    </match>
    <hard-timeout>12</hard-timeout>
    <cookie>10</cookie>
    <idle-timeout>34</idle-timeout>
    <flow-name>pop-vlan-action</flow-name>
    <priority>2</priority>
    <barrier>false</barrier>
</flow>
edit retag flag offensive close merge delete

2 answers

Sort by ยป oldest newest most voted
0

answered 2015-07-28 08:50:18 -0700

jpete2477 gravatar image

Here is a working example:

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<flow xmlns="urn:opendaylight:flow:inventory">
    <strict>false</strict>
    <flow-name>pop_vlan_114_access_to_core</flow-name>
    <id>0</id>
    <cookie>0</cookie>
    <table_id>0</table_id>
    <priority>1</priority>
    <hard-timeout>0</hard-timeout>
    <idle-timeout>0</idle-timeout>
    <installHw>true</installHw>
    <instructions>
        <instruction>
            <order>0</order>
            <apply-actions>
                <action>
                    <pop-vlan-action/>
                    <order>0</order>
                </action>
                <action>
                    <order>1</order>
                    <output-action>
                        <output-node-connector>12</output-node-connector>
                    </output-action>
                </action>
            </apply-actions>
        </instruction>
    </instructions>
    <match>
        <vlan-match>
            <vlan-id>
                <vlan-id>114</vlan-id>
                <vlan-id-present>true</vlan-id-present>
            </vlan-id>
        </vlan-match>       
        <in-port>1</in-port>
    </match>
</flow>

Hope this helps.

edit flag offensive delete publish link more

Comments

Thanks a lot Jpete2477! It seems that "vlan-id" must be in matching fields. However, in my example, I do not care about vlan-id value; I just want to pop vlan tag of any packets. Any ideas are deeply appreciated.

tmtuan ( 2015-07-28 20:58:54 -0700 )edit
0

answered 2015-07-30 00:52:27 -0700

tmtuan gravatar image

My own answer. Vlan-id should be 0. Below is a working example.

<?xml version="1.0" encoding="utf-8"?>
<flow
    xmlns="urn:opendaylight:flow:inventory">
    <strict>false</strict>
    <flow-name>pop_vlan</flow-name>
    <id>999</id>
    <cookie_mask>255</cookie_mask>
    <cookie>401</cookie>
    <table_id>0</table_id>
    <priority>999</priority>
    <hard-timeout>3600</hard-timeout>
    <idle-timeout>1800</idle-timeout>
    <barrier>false</barrier>
    <installHw>false</installHw>
    <match>
        <ethernet-match>
            <ethernet-source>
                <address>00:00:00:00:00:01</address>
            </ethernet-source>
            <ethernet-destination>
                <address>00:00:00:00:00:03</address>
            </ethernet-destination>
        </ethernet-match>
        <vlan-match>
            <vlan-id>
                <vlan-id>0</vlan-id>
                <vlan-id-present>true</vlan-id-present>
            </vlan-id>
        </vlan-match>
    </match>
    <instructions>
        <instruction>
            <order>0</order>
            <apply-actions>
                <action>
                    <pop-vlan-action/>
                    <order>0</order>
                </action>
                <action>
                    <output-action>
                        <output-node-connector>1</output-node-connector>
                    </output-action>
                    <order>1</order>
                </action>
            </apply-actions>
        </instruction>
    </instructions>
</flow>
edit flag offensive delete publish link more

Comments

Great catch. This actually solved a problem I was having. Thanks!

jpete2477 ( 2015-08-25 10:14:52 -0700 )edit
Login/Signup to Answer

Question Tools

Follow
1 follower

Stats

Asked: 2015-07-28 02:15:15 -0700

Seen: 392 times

Last updated: Jul 30 '15