- Prevent Agent from crashing on MAcos due to the lack
of Netfiler
- Catch exception when SFF does not hava data plane locators
configured
Change-Id: I3c001c94262960f37f21ce8bae9a053004219763
Signed-off-by: Reinaldo Penno <[email protected]>
import threading
import subprocess
-from netfilterqueue import NetfilterQueue
+try:
+ from netfilterqueue import NetfilterQueue
+except ImportError:
+ print("Netfilter not supported or installed")
from nsh.encode import build_packet
from common.sfc_globals import ODLIP, USERNAME, PASSWORD
local_sff_topo = sfc_globals.get_sff_topo()
for sff_name, sff_value in local_sff_topo.items():
- for locator_value in sff_value['sff-data-plane-locator']:
- if locator_value['data-plane-locator']['ip'] != addr:
- continue
+ try:
+ for locator_value in sff_value['sff-data-plane-locator']:
+ if locator_value['data-plane-locator']['ip'] == addr:
+ return sff_name
+ else:
+ continue
+ except KeyError:
+ continue
- return sff_name
- else:
- return None
+ return None
def build_data_plane_service_path(service_path):