2 Library for dynamic flow construction.
3 Authors: james.luhrsen@hp.com
7 xmltodict and json libs not needed at this point, but may be useful in
11 # bare bones xml for building a flow xml for flow:inventory
12 flow_xml_skeleton = '<?xml version="1.0" encoding="UTF-8" standalone="no"?>' + \
13 '<flow xmlns="urn:opendaylight:flow:inventory">' + \
14 '<instructions></instructions>' + \
18 input_xml_skeleton = '<?xml version="1.0" encoding="UTF-8" standalone="no"?>' + \
19 '<input xmlns="urn:opendaylight:flow:service">' + \
25 Flow class for creating and interacting with OpenFlow flows
45 def set_field(self, field, value):
47 allows for generically setting any attribute in this
48 class based on the 'field' passed in. In the future,
49 adding a new attribute only requires that single line
50 addition. no need for additional setter.
52 setattr(self, field, value)
55 def Make_Inventory_Flow():
57 Robot Keyword to create and return an instance of the Flow
61 flow.xml = flow_xml_skeleton
65 def Make_Service_Flow():
67 Robot Keyword to create an input XML that can be used to
68 directly send to flow:service for things like accessing
69 the remove-flow RPC via restconf
72 flow.xml = input_xml_skeleton
76 def Set_Flow_Field(flow, field, value):
78 Robot Keyword to allow the modification (setting) of the
79 flow object attributes
81 flow.set_field(field, value)
85 # def Convert_Flow_XML_To_Json(flow):
87 # There may be a need in the future to use json to push
88 # flows, as opposed to xml format that is prevalent in
89 # test code at this point. This function will give a
90 # conversion, but unsure if it's proper. Also, unsure
91 # if the xmltodict library is viable in the CSIT environment
93 # flowXmlDict = xmltodict.parse(flow.xml)
94 # flow.json = json.dumps(flowXmlDict)