def _list_and_update_local_logical_device_flow_groups(self, id): # retrieve flow list res = self.get('/api/v1/local/logical_devices/{' '}/flow_groups'.format(id)) len_before = len(res['items']) # add some flows req = ofp.FlowGroupTableUpdate( id=id, group_mod=ofp.ofp_group_mod( command=ofp.OFPGC_ADD, type=ofp.OFPGT_ALL, group_id=len_before + 1, buckets=[ ofp.ofp_bucket(actions=[ ofp.ofp_action(type=ofp.OFPAT_OUTPUT, output=ofp.ofp_action_output(port=1)) ]) ])) res = self.post('/api/v1/local/logical_devices/{' '}/flow_groups'.format(id), MessageToDict(req, preserving_proto_field_name=True), expected_http_code=200) # TODO check some stuff on res res = self.get('/api/v1/local/logical_devices/{' '}/flow_groups'.format(id)) len_after = len(res['items']) self.assertGreater(len_after, len_before)
def _list_and_update_logical_device_flow_groups(self, id): # retrieve flow list res = self.get('/api/v1/logical_devices/{}/flow_groups'.format(id)) len_before = len(res['items']) # add some flows req = ofp.FlowGroupTableUpdate( id=id, group_mod=ofp.ofp_group_mod( command=ofp.OFPGC_ADD, type=ofp.OFPGT_ALL, group_id=len_before + 1, buckets=[ ofp.ofp_bucket( actions=[ ofp.ofp_action( type=ofp.OFPAT_OUTPUT, output=ofp.ofp_action_output( port=1 ) ) ] ) ] ) ) res = self.post('/api/v1/logical_devices/{}/flow_groups'.format(id), MessageToDict(req, preserving_proto_field_name=True), expected_http_code=200) # TODO check some stuff on res res = self.get('/api/v1/logical_devices/{}/flow_groups'.format(id)) len_after = len(res['items']) self.assertGreater(len_after, len_before)
def output(port, max_len=ofp.OFPCML_MAX): return action( type=OUTPUT, output=ofp.ofp_action_output(port=port, max_len=max_len) )
def output(port, max_len=ofp.OFPCML_MAX): return action( type=OUTPUT, output=ofp.ofp_action_output(port=port, max_len=max_len) )