Merge "Changed the body of flows."
authorLuis Gomez <ecelgp@gmail.com>
Mon, 5 Jan 2015 01:52:22 +0000 (01:52 +0000)
committerGerrit Code Review <gerrit@opendaylight.org>
Mon, 5 Jan 2015 01:52:22 +0000 (01:52 +0000)
test/csit/suites/openflowplugin/Groups_Meters_OF13/005__openflow_group.txt [new file with mode: 0644]
test/csit/suites/openflowplugin/Groups_Meters_OF13/010__openflow_meter.txt [new file with mode: 0644]
test/csit/suites/openflowplugin/Groups_Meters_OF13/__init__.txt [new file with mode: 0644]
test/csit/variables/xmls/f50.xml [new file with mode: 0644]
test/csit/variables/xmls/f51.xml [new file with mode: 0644]
test/csit/variables/xmls/g4.xml [new file with mode: 0644]
test/csit/variables/xmls/m4.xml [new file with mode: 0644]

diff --git a/test/csit/suites/openflowplugin/Groups_Meters_OF13/005__openflow_group.txt b/test/csit/suites/openflowplugin/Groups_Meters_OF13/005__openflow_group.txt
new file mode 100644 (file)
index 0000000..73a519e
--- /dev/null
@@ -0,0 +1,95 @@
+*** Settings ***
+Documentation     Test suite for OpenFlow group
+Suite Setup       Create Session    session    http://${CONTROLLER}:${RESTCONFPORT}    auth=${AUTH}    headers=${HEADERS_XML}
+Suite Teardown    Delete All Sessions
+Library           SSHLibrary
+Library           Collections
+Library           OperatingSystem
+Library           ../../../libraries/RequestsLibrary.py
+Library           ../../../libraries/Common.py
+Variables         ../../../variables/Variables.py
+Resource          ../../../libraries/Utils.txt
+
+*** Variables ***
+${REST_CONTEXT}    /restconf/operational/opendaylight-inventory:nodes/
+${REST_CONTEXT_CF}    /restconf/config/opendaylight-inventory:nodes/node/openflow:1
+${REST_CONTEXT_OP}    /restconf/operational/opendaylight-inventory:nodes/node/openflow:1
+${GROUP}          ${CURDIR}/../../../variables/xmls/g4.xml
+${FLOW}           ${CURDIR}/../../../variables/xmls/f50.xml
+${GROUP_NAME}     Foo
+${FLOW_NAME}      forward
+
+*** Test Cases ***
+Get list of nodes
+    [Documentation]    Get the inventory to make sure openflow:1 comes up
+    ${resp}    RequestsLibrary.Get    session    ${REST_CONTEXT}
+    Log    ${resp.content}
+    Should Be Equal As Strings    ${resp.status_code}    200
+    Should Contain    ${resp.content}    openflow:1
+
+Add a group
+    [Documentation]    Add a group using RESTCONF
+    [Tags]    Push
+    ${body}    OperatingSystem.Get File    ${GROUP}
+    Set Suite Variable    ${body}
+    ${resp}    Putxml    session    ${REST_CONTEXT_CF}/group/1    data=${body}
+    Log    ${resp.content}
+    Should Be Equal As Strings    ${resp.status_code}    200
+
+Verify after adding group config
+    [Documentation]    Get the group stat in config
+    ${resp}    RequestsLibrary.Get    session    ${REST_CONTEXT_CF}/group/1
+    Log    ${resp.content}
+    Should Be Equal As Strings    ${resp.status_code}    200
+    Should Contain    ${resp.content}    ${GROUP_NAME}
+
+Verify after adding group operational
+    [Documentation]    Get the group stat in operational
+    ${elements}=    Create List    group-statistics    group-desc
+    Wait Until Keyword Succeeds    60s    2s    Check For Elements At URI    ${REST_CONTEXT_OP}/group/1    ${elements}
+
+Add a flow that includes a group
+    [Documentation]    Push a flow through RESTCONF
+    [Tags]    Push
+    ${body}    OperatingSystem.Get File    ${FLOW}
+    Set Suite Variable    ${body}
+    ${resp}    Putxml    session    ${REST_CONTEXT_CF}/table/0/flow/1    data=${body}
+    Log    ${resp.content}
+    Should Be Equal As Strings    ${resp.status_code}    200
+
+Verify after adding flow config
+    [Documentation]    Verify the flow
+    [Tags]    Get
+    ${resp}    RequestsLibrary.Get    session    ${REST_CONTEXT_CF}/table/0/flow/1
+    Log    ${resp.content}
+    Should Be Equal As Strings    ${resp.status_code}    200
+    Should Contain    ${resp.content}    ${FLOW_NAME}
+
+Verify after adding flow operational
+    [Documentation]    Verify the flow
+    ${elements}=    Create List    group-action    group-id
+    Wait Until Keyword Succeeds    60s    2s    Check For Elements At URI    ${REST_CONTEXT_OP}/table/0/flow/1    ${elements}
+
+Remove the flow
+    [Documentation]    Remove the flow
+    ${resp}    RequestsLibrary.Delete    session    ${REST_CONTEXT_CF}/table/0/flow/1
+    Should Be Equal As Strings    ${resp.status_code}    200
+
+Verify after deleting flow
+    [Documentation]    Verify the flow removal
+    [Tags]    Get
+    ${resp}    RequestsLibrary.Get    session    ${REST_CONTEXT_CF}/table/0/flow/1
+    Should Not Contain    ${resp.content}    ${FLOW_NAME}
+
+Delete the group
+    [Documentation]    Remove the group
+    [Tags]    Delete
+    ${resp}    RequestsLibrary.Delete    session    ${REST_CONTEXT_CF}/group/1
+    Log    ${resp.content}
+    Should Be Equal As Strings    ${resp.status_code}    200
+
+Verify after deleting group
+    [Documentation]    Verify the flow removal
+    [Tags]    Get
+    ${resp}    RequestsLibrary.Get    session    ${REST_CONTEXT_CF}/group/1
+    Should Not Contain    ${resp.content}    ${GROUP_NAME}
diff --git a/test/csit/suites/openflowplugin/Groups_Meters_OF13/010__openflow_meter.txt b/test/csit/suites/openflowplugin/Groups_Meters_OF13/010__openflow_meter.txt
new file mode 100644 (file)
index 0000000..d78935a
--- /dev/null
@@ -0,0 +1,95 @@
+*** Settings ***
+Documentation     Test suite for OpenFlow meter
+Suite Setup       Create Session    session    http://${CONTROLLER}:${RESTCONFPORT}    auth=${AUTH}    headers=${HEADERS_XML}
+Suite Teardown    Delete All Sessions
+Library           SSHLibrary
+Library           Collections
+Library           OperatingSystem
+Library           ../../../libraries/RequestsLibrary.py
+Library           ../../../libraries/Common.py
+Variables         ../../../variables/Variables.py
+Resource          ../../../libraries/Utils.txt
+
+*** Variables ***
+${REST_CONTEXT}    /restconf/operational/opendaylight-inventory:nodes/
+${REST_CONTEXT_CF}    /restconf/config/opendaylight-inventory:nodes/node/openflow:1
+${REST_CONTEXT_OP}    /restconf/operational/opendaylight-inventory:nodes/node/openflow:1
+${METER}          ${CURDIR}/../../../variables/xmls/m4.xml
+${FLOW}           ${CURDIR}/../../../variables/xmls/f51.xml
+${METER_NAME}     Foo
+${FLOW_NAME}      forward
+
+*** Test Cases ***
+Get list of nodes
+    [Documentation]    Get the inventory to make sure openflow:1 comes up
+    ${resp}    RequestsLibrary.Get    session    ${REST_CONTEXT}
+    Log    ${resp.content}
+    Should Be Equal As Strings    ${resp.status_code}    200
+    Should Contain    ${resp.content}    openflow:1
+
+Add a meter
+    [Documentation]    Add a meter using RESTCONF
+    [Tags]    Push
+    ${body}    OperatingSystem.Get File    ${METER}
+    Set Suite Variable    ${body}
+    ${resp}    Putxml    session    ${REST_CONTEXT_CF}/meter/1    data=${body}
+    Log    ${resp.content}
+    Should Be Equal As Strings    ${resp.status_code}    200
+
+Verify after adding meter config
+    [Documentation]    Get the meter stat in config
+    ${resp}    RequestsLibrary.Get    session    ${REST_CONTEXT_CF}/meter/1
+    Log    ${resp.content}
+    Should Be Equal As Strings    ${resp.status_code}    200
+    Should Contain    ${resp.content}    ${METER_NAME}
+
+Verify after adding meter operational
+    [Documentation]    Get the meter stat in operational
+    ${elements}=    Create List    meter-statistics    meter-config-stats
+    Wait Until Keyword Succeeds    60s    2s    Check For Elements At URI    ${REST_CONTEXT_OP}/meter/1    ${elements}
+
+Add a flow that includes a meter
+    [Documentation]    Push a flow through RESTCONF
+    [Tags]    Push
+    ${body}    OperatingSystem.Get File    ${FLOW}
+    Set Suite Variable    ${body}
+    ${resp}    Putxml    session    ${REST_CONTEXT_CF}/table/0/flow/2    data=${body}
+    Log    ${resp.content}
+    Should Be Equal As Strings    ${resp.status_code}    200
+
+Verify after adding flow config
+    [Documentation]    Verify the flow
+    [Tags]    Get
+    ${resp}    RequestsLibrary.Get    session    ${REST_CONTEXT_CF}/table/0/flow/2
+    Log    ${resp.content}
+    Should Be Equal As Strings    ${resp.status_code}    200
+    Should Contain    ${resp.content}    ${FLOW_NAME}
+
+Verify after adding flow operational
+    [Documentation]    Verify the flow
+    ${elements}=    Create List    meter-id    flow
+    Wait Until Keyword Succeeds    60s    2s    Check For Elements At URI    ${REST_CONTEXT_OP}/table/0/flow/2    ${elements}
+
+Remove the flow
+    [Documentation]    Remove the flow
+    ${resp}    RequestsLibrary.Delete    session    ${REST_CONTEXT_CF}/table/0/flow/2
+    Should Be Equal As Strings    ${resp.status_code}    200
+
+Verify after deleting flow
+    [Documentation]    Verify the flow removal
+    [Tags]    Get
+    ${resp}    RequestsLibrary.Get    session    ${REST_CONTEXT_CF}/table/0/flow/2
+    Should Not Contain    ${resp.content}    ${FLOW_NAME}
+
+Delete the meter
+    [Documentation]    Remove the meter
+    [Tags]    Delete
+    ${resp}    RequestsLibrary.Delete    session    ${REST_CONTEXT_CF}/meter/1
+    Log    ${resp.content}
+    Should Be Equal As Strings    ${resp.status_code}    200
+
+Verify after deleting meter
+    [Documentation]    Verify the flow removal
+    [Tags]    Get
+    ${resp}    RequestsLibrary.Get    session    ${REST_CONTEXT_CF}/meter/1
+    Should Not Contain    ${resp.content}    ${METER_NAME}
diff --git a/test/csit/suites/openflowplugin/Groups_Meters_OF13/__init__.txt b/test/csit/suites/openflowplugin/Groups_Meters_OF13/__init__.txt
new file mode 100644 (file)
index 0000000..f1a9f43
--- /dev/null
@@ -0,0 +1,12 @@
+*** Settings ***
+Documentation     Test suite for the OpenDaylight base edition with of13
+Suite Setup       Start Suite
+Suite Teardown    Stop Suite
+Library           SSHLibrary
+Resource          ../../../libraries/Utils.txt
+Variables         ../../../variables/Variables.py
+
+*** Variables ***
+${start}          sudo mn --controller=remote,ip=${CONTROLLER} --topo tree,1 --switch user
+
+*** Keywords ***
diff --git a/test/csit/variables/xmls/f50.xml b/test/csit/variables/xmls/f50.xml
new file mode 100644 (file)
index 0000000..ddc2429
--- /dev/null
@@ -0,0 +1,30 @@
+<flow xmlns="urn:opendaylight:flow:inventory">
+    <strict>false</strict>
+    <hard-timeout>0</hard-timeout>
+    <idle-timeout>0</idle-timeout>
+    <instructions>
+        <instruction>
+            <order>0</order>
+            <apply-actions>
+                <action>
+                    <group-action>
+                        <group-id>1</group-id>
+                    </group-action>
+                    <order>1</order>
+                </action>
+            </apply-actions>
+        </instruction>
+    </instructions>
+    <table_id>0</table_id>
+    <id>1</id>
+    <match>
+        <ethernet-match>
+            <ethernet-type>
+                <type>2048</type>
+            </ethernet-type>
+        </ethernet-match>
+        <ipv4-destination>10.0.10.1/32</ipv4-destination>
+    </match>
+    <flow-name>forward</flow-name>
+    <priority>2</priority>
+</flow>
\ No newline at end of file
diff --git a/test/csit/variables/xmls/f51.xml b/test/csit/variables/xmls/f51.xml
new file mode 100644 (file)
index 0000000..31f5a07
--- /dev/null
@@ -0,0 +1,36 @@
+<flow xmlns="urn:opendaylight:flow:inventory">
+    <strict>false</strict>
+    <hard-timeout>0</hard-timeout>
+    <idle-timeout>0</idle-timeout>
+    <instructions>
+        <instruction>
+            <order>0</order>
+            <apply-actions>
+                <action>
+                   <output-action>
+                        <output-node-connector>openflow:1:1</output-node-connector>
+                    </output-action>
+                    <order>1</order>
+                </action>
+            </apply-actions>
+        </instruction>
+        <instruction>
+            <order>1</order>
+            <meter>
+              <meter-id>1</meter-id>
+            </meter>
+        </instruction>
+    </instructions>
+    <table_id>0</table_id>
+    <id>2</id>
+    <match>
+        <ethernet-match>
+            <ethernet-type>
+                <type>2048</type>
+            </ethernet-type>
+        </ethernet-match>
+        <ipv4-destination>10.0.10.2/32</ipv4-destination>
+    </match>
+    <flow-name>forward</flow-name>
+    <priority>2</priority>
+</flow>
diff --git a/test/csit/variables/xmls/g4.xml b/test/csit/variables/xmls/g4.xml
new file mode 100644 (file)
index 0000000..cb1360c
--- /dev/null
@@ -0,0 +1,28 @@
+<group xmlns="urn:opendaylight:flow:inventory">
+    <group-type>group-select</group-type>
+    <buckets>
+        <bucket>
+           <weight>1</weight>
+            <action>
+                <output-action>
+                    <output-node-connector>openflow:1:1</output-node-connector>
+                </output-action>
+                <order>1</order>
+            </action>
+            <bucket-id>1</bucket-id>
+        </bucket>
+        <bucket>
+          <weight>1</weight>
+            <action>
+                <output-action>
+                    <output-node-connector>openflow:1:2</output-node-connector>
+                </output-action>
+                <order>1</order>
+            </action>
+            <bucket-id>2</bucket-id>
+        </bucket>
+    </buckets>
+    <barrier>false</barrier>
+    <group-name>Foo</group-name>
+    <group-id>1</group-id>
+</group>
\ No newline at end of file
diff --git a/test/csit/variables/xmls/m4.xml b/test/csit/variables/xmls/m4.xml
new file mode 100644 (file)
index 0000000..ef3bd07
--- /dev/null
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<meter xmlns="urn:opendaylight:flow:inventory">
+    <flags>meter-kbps</flags>
+    <meter-band-headers>
+        <meter-band-header>
+            <band-id>0</band-id>
+            <drop-rate>20</drop-rate>
+            <drop-burst-size>200</drop-burst-size>
+            <meter-band-types>
+                <flags>ofpmbt-drop</flags>
+            </meter-band-types>
+        </meter-band-header>
+    </meter-band-headers>
+    <meter-id>1</meter-id>
+    <meter-name>Foo</meter-name>
+</meter>