From c69041f603d823cfccd5be88422eab72babfa312 Mon Sep 17 00:00:00 2001 From: Varun Patil Date: Wed, 18 May 2022 14:17:54 -0700 Subject: [PATCH] Allow existing faces in createFace Change-Id: I48c09c34a81822c25cbab25bff979194829e067f --- minindn/helpers/nfdc.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/minindn/helpers/nfdc.py b/minindn/helpers/nfdc.py index 1ba926f..9e1e184 100644 --- a/minindn/helpers/nfdc.py +++ b/minindn/helpers/nfdc.py @@ -74,7 +74,7 @@ class Nfdc(object): Minindn.sleep(SLEEP_TIME) @staticmethod - def createFace(node, remoteNodeAddress, protocol='udp', isPermanent=False): + def createFace(node, remoteNodeAddress, protocol='udp', isPermanent=False, allowExisting=True): '''Create face in node's NFD instance. Returns FaceID of created face or -1 if failed.''' cmd = ('nfdc face create {}://{} {}'.format( protocol, @@ -84,10 +84,10 @@ class Nfdc(object): output = node.cmd(cmd) debug(output) Minindn.sleep(SLEEP_TIME) - if "face-created" not in output: - return -1 - faceID = output.split(" ")[1][3:] - return faceID + if "face-created" in output or (allowExisting and "face-exists" in output): + faceID = output.split(" ")[1][3:] + return faceID + return -1 @staticmethod def destroyFace(node, remoteNode, protocol='udp'):