def delete_namespace_label_policy(self, label_policy_list): if len(label_policy_list) == 0: return conf_list = [] for label_policy in label_policy_list: conf = { "tunnel_id": label_policy.vni, "namespace_label_value": label_policy.namespace_label_value, } conf_list.append(conf) if (conf_list_has_max_elements(conf, conf_list)): self.run_cli_delete_namespace_label_policy(conf_list) conf_list = [] self.run_cli_delete_namespace_label_policy(conf_list)
def update_pod_label_policy(self, label_policy_list): if len(label_policy_list) == 0: return conf_list = [] for label_policy in label_policy_list: conf = { "tunnel_id": label_policy.vni, "pod_label_value": label_policy.pod_label_value, "bit_value": str(label_policy.policy_bit_value), } conf_list.append(conf) if (conf_list_has_max_elements(conf, conf_list)): self.run_cli_update_pod_label_policy(conf_list) conf_list = [] self.run_cli_update_pod_label_policy(conf_list)
def delete_network_policy_protocol_port_ingress(self, port_networkpolicy_list): if len(port_networkpolicy_list) == 0: return conf_list = [] for port_networkpolicy in port_networkpolicy_list: conf = { "tunnel_id": port_networkpolicy.vni, "local_ip": port_networkpolicy.local_ip, "protocol": port_networkpolicy.get_protocol_int(), "port": port_networkpolicy.port, "bit_value": str(port_networkpolicy.policy_bit_value), } conf_list.append(conf) if (conf_list_has_max_elements(conf, conf_list)): self.run_cli_delete_network_policy_protocol_port_ingress( conf_list) conf_list = [] self.run_cli_delete_network_policy_protocol_port_ingress(conf_list)
def delete_network_policy_ingress(self, cidr_networkpolicy_list): if len(cidr_networkpolicy_list) == 0: return conf_list = [] for cidr_networkpolicy in cidr_networkpolicy_list: conf = { "tunnel_id": cidr_networkpolicy.vni, "local_ip": cidr_networkpolicy.local_ip, "cidr_prefixlen": str(cidr_networkpolicy.cidr_length), "cidr_ip": cidr_networkpolicy.cidr, "cidr_type": cidr_networkpolicy.get_cidr_type_int(), "bit_value": str(cidr_networkpolicy.policy_bit_value), } conf_list.append(conf) if (conf_list_has_max_elements(conf, conf_list)): self.run_cli_delete_network_policy_ingress(conf_list) conf_list = [] self.run_cli_delete_network_policy_ingress(conf_list)