This commit is contained in:
Sven Zehl 2016-09-27 15:48:27 +02:00
parent 81b1093f35
commit c0691f0adc
2 changed files with 10 additions and 11 deletions

View File

@ -25,15 +25,14 @@ if __name__ == "__main__":
- B. time slots 5-8 can be used by any best effort traffic towards STA with MAC address 34:13:e8:24:77:be - B. time slots 5-8 can be used by any best effort traffic towards STA with MAC address 34:13:e8:24:77:be
- B. the other time slots are guard time slots, i.e. blocked from being used - B. the other time slots are guard time slots, i.e. blocked from being used
''' '''
log = logging.getLogger() log = logging.getLogger()
log.setLevel(logging.INFO)
handler = logging.StreamHandler() handler = logging.StreamHandler()
handler.setLevel(logging.INFO) handler.setLevel(logging.INFO)
formatter = logging.Formatter("%(levelname)s - %(message)s") formatter = logging.Formatter("%(levelname)s - %(message)s")
handler.setFormatter(formatter) handler.setFormatter(formatter)
log.addHandler(handler) log.addHandler(handler)
# configuration of hybrid MAC # configuration of hybrid MAC
dstHWAddr = "34:13:e8:24:77:be" # STA destination MAC address dstHWAddr = "34:13:e8:24:77:be" # STA destination MAC address
total_slots = 10 total_slots = 10
@ -61,10 +60,10 @@ if __name__ == "__main__":
# install MAC Processor # install MAC Processor
if mac.install_mac_processor(): if mac.install_mac_processor():
log.info('HMAC is running ...') log.info('HMAC is running ...')
log.info('HMAC conf: %s' % mac.printConfiguration()) mac.printConfiguration()
# wait 10 seconds # wait 20 seconds
time.sleep(10) time.sleep(20)
log.info('Update HMAC with new configuration ...') log.info('Update HMAC with new configuration ...')
@ -86,9 +85,9 @@ if __name__ == "__main__":
# update MAC Processor # update MAC Processor
if mac.update_mac_processor(): if mac.update_mac_processor():
log.info('HMAC is updated ...') log.info('HMAC is updated ...')
log.info('HMAC new conf: %s' % mac.printConfiguration()) mac.printConfiguration()
time.sleep(10) time.sleep(20)
log.info("Stopping HMAC") log.info("Stopping HMAC")

View File

@ -105,11 +105,11 @@ class HybridTDMACSMAMac(object):
Return the MAC configuration serialized as string. Return the MAC configuration serialized as string.
:return: :return:
''' '''
s = '[' self.log.info('[')
for ii in range(self.getNumSlots()): for ii in range(self.getNumSlots()):
s = s + str(ii) + ': ' + self.getAccessPolicy(ii).printConfiguration() + "\n" nline = str(ii) + ': ' + self.getAccessPolicy(ii).printConfiguration()
s = s + ']' self.log.info(nline)
return s self.log.info(']')
def install_mac_processor(self): def install_mac_processor(self):