コード例 #1
0
ファイル: bt2dpvn.py プロジェクト: sabdhagiri/Provisioning
def bt2_units():
	base_dir=GF.get_configxml('DProvXML', 1)
	deprov_file=base_dir+'/'+deprovxml
	try:
		deprov_fileobj=open(deprov_file, "r")
	except Exception as error:
		GF.print_error("Reading deprovision file", error, 1)
	else:
		bt2Units=list()
		deprov_xmlobj=GF.open_configxml(deprov_fileobj)
		deprov_fileobj.close()
		base_node=deprov_xmlobj.getroot()
		base_locaddr=int(base_node.attrib.get('addrBase'))
		for node in deprov_xmlobj.findall('.//xcoders//HashMap'):
			resource_id=node.find('.//NA').attrib.get('value')
			xcode_node=node.find('.//XCodeDevCfgT')
			macaddr_node=xcode_node.findall('.//macAddr//MacAddressT//List//NA')
			loc_addr=int(xcode_node.attrib.get('locAddr'))
			xcode_mac=''
			for mac in macaddr_node:
				val=int(mac.attrib.get('value'))
				hex_val="%02X" % int(hex(val&0xff)[2:], 16)
				xcode_mac=xcode_mac+hex_val
			macaddr=GF.prettify(xcode_mac)
			ip=GF.int2ip(base_locaddr+loc_addr)
			return_result=GF.formdhcp_host(resource_id, macaddr, ip)
			bt2Units.append(return_result)
		GF.writeDHCP_BT2_Units(bt2Units)
コード例 #2
0
ファイル: bt2ppvn.py プロジェクト: sabdhagiri/Provisioning
import global_functions as GF

GF.workdir()
GF.open_global_xml()

antboards=list()
xcdboards=list()
streamers=list()

# creating mysql connection
mysql_conn=GF.create_dbconn()

# creating preprovison xml file object
preprov_flobj=GF.get_configxml("PreProvXML")

preprov_xmlobj=GF.open_configxml(preprov_flobj)

GF.dhcp_host_db(mysql_conn, 'Antenna Board', antboards)
GF.dhcp_host_db(mysql_conn, 'Transcoder Board', xcdboards)
GF.dhcp_host_db(mysql_conn, 'Streamer', streamers)

GF.parse_dhcp_xml(preprov_xmlobj, 'AntBoard', antboards, mysql_conn)
GF.parse_dhcp_xml(preprov_xmlobj, 'XCodeBoard', xcdboards, mysql_conn)
GF.parse_dhcp_xml(preprov_xmlobj, 'StrmrDevCfg', streamers, mysql_conn)

GF.create_dhcp_config('AntBoard', antboards)
GF.create_dhcp_config('XCodeBoard', xcdboards)
GF.create_dhcp_config('Streamer', streamers)

GF.append_vixs_units(mysql_conn)