Skip to content

Commit

Permalink
make-pretty
Browse files Browse the repository at this point in the history
  • Loading branch information
EskoDijk committed Nov 3, 2024
1 parent bd1afa3 commit 6202dda
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
15 changes: 12 additions & 3 deletions pylibs/case_studies/ccm.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,11 @@

thread_domain_name = "TestCcmDomain"


def setupNs():
logging.info("Setting up for Thread CCM sandbox")
ns = OTNS(otns_args=['-log', 'debug', '-pcap', 'wpan-tap', '-seed', '4', '-ot-script', './pylibs/case_studies/ccm.yaml'])
ns = OTNS(
otns_args=['-log', 'debug', '-pcap', 'wpan-tap', '-seed', '4', '-ot-script', './pylibs/case_studies/ccm.yaml'])
ns.watch_default('debug')
ns.web()
ns.set_title('Thread CCM sandbox for IETF 121')
Expand All @@ -55,6 +57,7 @@ def setupNs():
#ns.radiomodel = 'MIDisc' # enforce strict line topologies for testing
return ns


def setActiveDataset(ns, n1) -> None:
ns.node_cmd(n1, "dataset init new")
ns.node_cmd(n1, "dataset networkname CcmTestNet")
Expand All @@ -68,15 +71,17 @@ def setActiveDataset(ns, n1) -> None:
ns.node_cmd(n1, "dataset securitypolicy 672 orcCR 3") # enable CCM-commissioning flag in secpolicy
ns.node_cmd(n1, "dataset commit active")


def startRegistrar(ns):
logging.debug("starting OT Registrar")
ns.registrar_log_file = open("tmp/ot-registrar.log", 'w')
subprocess.Popen([
'java', '-jar', './etc/ot-registrar/ot-registrar.jar', '-registrar', '-vvv', '-f',
'./etc/ot-registrar/credentials_registrar.p12', '-d', thread_domain_name
],
stdout=ns.registrar_log_file,
stderr=subprocess.STDOUT)
stdout=ns.registrar_log_file,
stderr=subprocess.STDOUT)


def verifyRegistrarStarted():
for n in range(1, 20):
Expand All @@ -90,6 +95,7 @@ def verifyRegistrarStarted():
return True
return False


def enrollBr(ns, nid):
ns.coaps() # clear coaps

Expand All @@ -104,6 +110,7 @@ def enrollBr(ns, nid):
logging.error("BR may not have enrolled correctly.")
#raise Exception("BR may not have enrolled correctly.")


def setupStartTopology(ns):
n1 = ns.add("br", version="ccm")
ns.go(1)
Expand All @@ -128,6 +135,7 @@ def setupStartTopology(ns):
ns.speed = 1
ns.autogo = True


def main():
ns = setupNs()
if not verifyRegistrarStarted():
Expand All @@ -138,6 +146,7 @@ def main():
setupStartTopology(ns)
ns.interactive_cli()


if __name__ == '__main__':
try:
main()
Expand Down
2 changes: 1 addition & 1 deletion pylibs/unittests/test_basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -903,7 +903,7 @@ def testLoadOtScript(self):
ns.add('sed')
ns.go(30)
self.assertFormPartitions(1)
for nid in range(1,8):
for nid in range(1, 8):
self.assertEqual('15', ns.node_cmd(nid, 'channel')[0])

def testPhyStats(self):
Expand Down

0 comments on commit 6202dda

Please sign in to comment.