- service_endpoint_ids = []
- service_endpoint_ids.append(service_endpoint_id)
- add_cp = {"service_endpoint_ids": service_endpoint_ids,
- "switch_dpid": switch_id,
- "switch_port": switch_port}
- work_cps[cp_name] = add_cp
+ # check cp has vlan
+ vlan = cp.get("service_endpoint_encapsulation_info").get("vlan")
+ if vlan:
+ service_endpoint_ids = []
+ service_endpoint_ids.append(service_endpoint_id)
+ add_cp = {"service_endpoint_ids": service_endpoint_ids,
+ "switch_dpid": switch_id,
+ "switch_port": switch_port,
+ "vlan": vlan}
+ work_cps[cp_name] = add_cp
+ else:
+ self.logger.warning("cp service_endpoint_id : {} has no vlan, ignore".
+ format(service_endpoint_id))