示例#1
0
	def __init__(self, name, path, namespace, cacheLifetime, parameters):
		"""
		Create an instance and inicialize the structure needed by it.
		@type  parameters: dictionary
		@param parameters : Should be a dictionary containning the follow keys:
							- host : the host ip-address where the device is locate.
							- port : the port number where the Quagga software router is listen at the Telnet Connection.
							- password and enable\_pass :  The passwords to allow a connection to the device and for set root privileges for configurate it, respectibility.
							- instance : It allows to create more than one instance of the module adding an \textit {instance} attribute with the value specified by it into the root node of the XML BGP Configuration document. If it not specified it will not add anything.
							- allowxpath : It turn on or off the xpath "Looking into the Values" capability as specified by the value. If it is not specified the default value is false.
		"""

		Module.__init__(self, name, path, namespace, cacheLifetime)

		host = parameters["host"]
		port = parameters["port"]
		password = parameters["password"]
		enable_password = parameters["enable_pass"]

		self.deviceConnection = VTY_Connection(host, port, password, enable_password)

		allowxpath = False
		
		if( "allowxpath" in parameters):
			if (parameters["allowxpath"] == "true"):
				allowxpath = True
		
		if( "instance" in parameters):
			instance = parameters["instance"]
		else: 
			instance = None
		
		structXML = NonvalidatingReader.parseUri("file:"+self.PROTOCOL_STRUCTURE_FILE)
		
		self.XMLConstructor = XML_Constructor.XML_Constructor(structXML, self.namespace, instance)
		self.XMLInterpreter = XML_Interpreter.XML_Interpreter(structXML, self.namespace, allowxpath)