def test_capture(self): restclient = RESTClient("localhost:8082", scheme=self.schemeHTTP, username=self.username, password=self.password, insecure=True) capture1 = restclient.capture_create( "G.V().Has('Name', 'test', 'Type', 'netns')") captures = restclient.capture_list() self.assertGreaterEqual(len(captures), 1, "no capture found") for capture in captures: if (capture.uuid == capture1.uuid): found = True break self.assertTrue(found, "created capture not found") restclient.capture_delete(capture1.uuid)
from skydive.rest.client import RESTClient import yaml conf_vars = yaml.load(open('tests_conf.yaml')) SKYDIVE_IP = conf_vars.get('skydive_ip', '9.148.244.26') SKYDIVE_PORT = conf_vars.get('skydive_port', '30777') restclient = RESTClient(SKYDIVE_IP + ":" + SKYDIVE_PORT) captures = restclient.capture_list() print("capture before") for capture in captures: print("capture", capture) restclient.capture_create( "G.V().Has('Manager', NE('k8s'),'Docker.Labels.app', Regex('.*wordpress.*'),'Docker.Labels.tier', Regex('frontend')).Both().Out('Name','eth0')" ) print("captures after") captures = restclient.capture_list() for capture in captures: print("capture", capture)