Signed-off-by: Yu Mingfei<[email protected]>
---
client/virt/libvirt_xml.py | 37 ++++++++++++++++++++++++++++++++++++-
1 files changed, 36 insertions(+), 1 deletions(-)
diff --git a/client/virt/libvirt_xml.py b/client/virt/libvirt_xml.py
index 863022b..c29a307 100644
--- a/client/virt/libvirt_xml.py
+++ b/client/virt/libvirt_xml.py
@@ -11,5 +11,40 @@ class LibvirtXMLVMNameError(LibvirtXMLError):
pass
-class LibvirtXML(xml_utils.XMLBase):
+class LibvirtXML(xml_utils.XMLTreeFile):
pass
+
+
+class NetworkXMLError(Exception):
+ pass
+
+
+class NetworkXML(xml_utils.XMLTreeFile):
+ """
+ To configure network xml file.
+ """
+
+ # The root of network xml
+ network_xml = None
+
+ def __init__(self, xml):
+ """
+ Initialize from a string or filename containing Network XML source.
+
+ param: xml: A filename or string containing Network XML
+ """
+ xml_utils.XMLTreeFile.__init__(self, xml)
+ self.network_xml = self._root
+
+
+ def general_metadata_config(self, name="", uuid=""):
+ """
+ Edit xml's name and uuid.
+
+ @param name:name of network.
+ @param uuid:uuid of network.
+ """
+ if name:
+ self.network_xml.find('name').text = name
+ if uuid:
+ self.network_xml.find('uuid').text = uuid
-- 1.7.1
--
Best Regards
Yu Mingfei
_______________________________________________
Autotest-kernel mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/autotest-kernel