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
13 '<?xml version="1.0" encoding="UTF-8" standalone="no"?>'
14 + '<flow xmlns="urn:opendaylight:flow:inventory">'
15 + "<instructions></instructions>"
20 input_xml_skeleton = (
21 '<?xml version="1.0" encoding="UTF-8" standalone="no"?>'
22 + '<input xmlns="urn:opendaylight:flow:service">'
29 Flow class for creating and interacting with OpenFlow flows
49 def set_field(self, field, value):
51 allows for generically setting any attribute in this
52 class based on the 'field' passed in. In the future,
53 adding a new attribute only requires that single line
54 addition. no need for additional setter.
56 setattr(self, field, value)
59 def Make_Inventory_Flow():
61 Robot Keyword to create and return an instance of the Flow
65 flow.xml = flow_xml_skeleton
69 def Make_Service_Flow():
71 Robot Keyword to create an input XML that can be used to
72 directly send to flow:service for things like accessing
73 the remove-flow RPC via restconf
76 flow.xml = input_xml_skeleton
80 def Set_Flow_Field(flow, field, value):
82 Robot Keyword to allow the modification (setting) of the
83 flow object attributes
85 flow.set_field(field, value)
89 # def Convert_Flow_XML_To_Json(flow):
91 # There may be a need in the future to use json to push
92 # flows, as opposed to xml format that is prevalent in
93 # test code at this point. This function will give a
94 # conversion, but unsure if it's proper. Also, unsure
95 # if the xmltodict library is viable in the CSIT environment
97 # flowXmlDict = xmltodict.parse(flow.xml)
98 # flow.json = json.dumps(flowXmlDict)