Esempio n. 1
0
def main():
    filename = 'data/output.json'
    output_file = 'output/output.txt'

    common.clear_file(output_file)
    common.append_to_file(output_file, display_text(filename, 'interfaces'))
    common.append_to_file(output_file,
                          display_text(filename, 'interfaces_counters'))
Esempio n. 2
0
	def update_mw(self,force_update=False):
		# I haven't add resid in this body, which can be done with other interfaces
		# but at lease one devid should be included in this body,
		# or the following call add_dev will fail

		# force_update means force updating property
		if not force_update and common.is_updated() == True:
			return

		body = common.rd_prop('../cfg/gw_property.xml')
		header = {'Content-type':'text/xml'}
		print 'updating gateway property...'
		
		ret = restful.method_post(init.url_updateMW + '/' + self.mwid,body,header)
		if ret.split('>')[2].split('<')[0] == 'true':
			print 'update gateway property ok'
			common.wr_settings('1','',2)
			common.clear_file('../cfg/mac_dev_map.cfg')
			common.clear_file('../cfg/mac_resID_resPlat_map.cfg')
Esempio n. 3
0
    def update_mw(self, force_update=False):
        # I haven't add resid in this body, which can be done with other interfaces
        # but at lease one devid should be included in this body,
        # or the following call add_dev will fail

        # force_update means force updating property
        if not force_update and common.is_updated() == True:
            return

        body = common.rd_prop('../cfg/gw_property.xml')
        header = {'Content-type': 'text/xml'}
        print 'updating gateway property...'

        ret = restful.method_post(init.url_updateMW + '/' + self.mwid, body,
                                  header)
        if ret.split('>')[2].split('<')[0] == 'true':
            print 'update gateway property ok'
            common.wr_settings('1', '', 2)
            common.clear_file('../cfg/mac_dev_map.cfg')
            common.clear_file('../cfg/mac_resID_resPlat_map.cfg')