Support OVSDB entity name format in Phosphorus
[integration/test.git] / csit / libraries / FlowLib.py
index cd884d22971070af9bdd796ea8910646e886704a..302faabd50c731c570060463632de2e0f89847a3 100644 (file)
@@ -3,27 +3,31 @@ Library for dynamic flow construction.
 Authors: james.luhrsen@hp.com
 Updated: 2014-08-29
 """
-'''
+"""
 xmltodict and json libs not needed at this point, but may be useful in
 the future.
-'''
+"""
 
 # bare bones xml for building a flow xml for flow:inventory
-flow_xml_skeleton = '<?xml version="1.0" encoding="UTF-8" standalone="no"?>' +      \
-                    '<flow xmlns="urn:opendaylight:flow:inventory">' +      \
-                    '<instructions></instructions>' +      \
-                    '<match></match>' +      \
-                    '</flow>'
+flow_xml_skeleton = (
+    '<?xml version="1.0" encoding="UTF-8" standalone="no"?>'
+    + '<flow xmlns="urn:opendaylight:flow:inventory">'
+    + "<instructions></instructions>"
+    + "<match></match>"
+    + "</flow>"
+)
 
-input_xml_skeleton = '<?xml version="1.0" encoding="UTF-8" standalone="no"?>' +      \
-                     '<input xmlns="urn:opendaylight:flow:service">' +      \
-                     '</input>'
+input_xml_skeleton = (
+    '<?xml version="1.0" encoding="UTF-8" standalone="no"?>'
+    + '<input xmlns="urn:opendaylight:flow:service">'
+    + "</input>"
+)
 
 
 class Flow:
-    '''
+    """
     Flow class for creating and interacting with OpenFlow flows
-    '''
+    """
 
     strict = "false"
     instruction_xmls = ""
@@ -43,41 +47,41 @@ class Flow:
     json = ""
 
     def set_field(self, field, value):
-        '''
-           allows for generically setting any attribute in this
-           class based on the 'field' passed in.  In the future,
-           adding a new attribute only requires that single line
-           addition.  no need for additional setter.
-        '''
+        """
+        allows for generically setting any attribute in this
+        class based on the 'field' passed in.  In the future,
+        adding a new attribute only requires that single line
+        addition.  no need for additional setter.
+        """
         setattr(self, field, value)
 
 
 def Make_Inventory_Flow():
-    '''
-        Robot Keyword to create and return an instance of the Flow
-        class.
-    '''
+    """
+    Robot Keyword to create and return an instance of the Flow
+    class.
+    """
     flow = Flow()
     flow.xml = flow_xml_skeleton
     return flow
 
 
 def Make_Service_Flow():
-    '''
-        Robot Keyword to create an input XML that can be used to
-        directly send to flow:service for things like accessing
-        the remove-flow RPC via restconf
-    '''
+    """
+    Robot Keyword to create an input XML that can be used to
+    directly send to flow:service for things like accessing
+    the remove-flow RPC via restconf
+    """
     flow = Flow()
     flow.xml = input_xml_skeleton
     return flow
 
 
 def Set_Flow_Field(flow, field, value):
-    '''
-        Robot Keyword to allow the modification (setting) of the
-        flow object attributes
-    '''
+    """
+    Robot Keyword to allow the modification (setting) of the
+    flow object attributes
+    """
     flow.set_field(field, value)
     return flow