futurewei-cloud / alcor

Alcor: Cloud native SDN platform powered by Kubernetes and Istio
MIT License
32 stars 33 forks source link

[DPM] Update to use the latest change in schema between DPM<->ACA #386

Open er1cthe0ne opened 4 years ago

er1cthe0ne commented 4 years ago

With the latest schema in master, we want to update DPM to:

  1. (after L3) Use the top level neighbor state for L2 neighbor, instead of using port state with operation_type=NEIGHBOR_CREATE_UPDATE, DPM is good to go, but somehow PM is still using it, tracked by #462
  2. (after L3) tunnel_id under subnet configuration should be using uint32 (big enough to handle ~16M valid VINs), need to change both subnet.proto and DPM, keep in mind we want to use the one under VPC.proto when we enable that workflow
  3. (after L3 - fixed) Not to populate network_type from port.proto, populate network_type in subnet configuration instead, confirmed DPM code is still using it
  4. (after L3 - fixed) Don't populate format_version and remove that field for all top level resources: dhcp/neighbor/port/router/subnet, set a format_version in the top level GoalState message->format_version to a number so that ACA can look for it, e.g. 101
  5. (after L3 - fixed) Don't populate project_id and remove that field for all top level resources: dhcp/neighbor/port/router/subnet except vpc
  6. (after L3 - fixed) Rename message_type to update_type in dhcp/neighbor/port/router/securitygroup/subnet.proto. This requires changes in the .proto schema file and DPM at the same time.
xieus commented 4 years ago

@er1cthe0ne Thanks for putting the details together. Let us discuss and plan to change the contract in one shot considering they could cause some breaking change.

xieus commented 3 years ago

@er1cthe0ne How is the issue going? Do we close all the pending issues listed above?

er1cthe0ne commented 3 years ago

@er1cthe0ne How is the issue going? Do we close all the pending issues listed above?

(1) is being changed in DPM now during the current L3 implementation. The remaining issues (2)(3)(4) has not been accounted for yet.

xieus commented 3 years ago

Okay. Thanks for the update. It seems that this would require some contract change again. Let us wait for L3 in if you also think so.

er1cthe0ne commented 3 years ago

Okay. Thanks for the update. It seems that this would require some contract change again. Let us wait for L3 in if you also think so.

(2) will have a minor contract change, we can wait when L3 is done.

(3)(4) can update DPM code anytime per latest contract, it does not need more contract change.

xieus commented 3 years ago

In this case, let us schedule a quick fix to the listed issues after L3. @haboy52581

haboy52581 commented 3 years ago

L3 contract already submitted on 1ef79b7

you could use this payload and output
1.Initially payload to create brand new p1-p4 payload:
{
  "vpcs_internal": [
    {
      "project_id": "3dda2801-d675-4688-a63f-dcda8d327f50",
      "id": "9192a4d4-ffff-4ece-b3f0-8d36e3d88038",
      "name": "test_vpc",
      "description": "",
      "cidr": "192.168.0.0/16"
    }
  ],
  "subnets_internal": [
    {
      "project_id": "3dda2801-d675-4688-a63f-dcda8d327f50",
      "network_id": "9192a4d4-ffff-4ece-b3f0-8d36e3d88038",
      "id": "a87e0f87-a2d9-44ef-9194-9a62f178594f",
      "name": "test_subnet2",
      "description": "",
      "cidr": "192.168.2.0/24",
      "gateway_ip": "192.168.2.1",
      "availability_zone": "uswest-1",
      "dhcp_enable": false,
      "primary_dns": null,
      "secondary_dns": null,
      "dns_list": null,
      "tunnel_id": "88889",
      "gatewayMacs": "96:ea:77:ad:52:55"
    },
    {
      "project_id": "3dda2801-d675-4688-a63f-dcda8d327f50",
      "network_id": "9192a4d4-ffff-4ece-b3f0-8d36e3d88038",
      "id": "a87e0f87-a2d9-44ef-9194-9a62f178594e",
      "name": "test_subnet3",
      "description": "",
      "cidr": "192.168.3.0/24",
      "gateway_ip": "192.168.3.1",
      "availability_zone": "uswest-1",
      "dhcp_enable": false,
      "primary_dns": null,
      "secondary_dns": null,
      "dns_list": null,
      "tunnel_id": "88888",
      "gatewayMacs": "96:ea:77:ad:52:54"
    }
  ],
  "neighbor_table": [
    {
      "neighbor_type": "L2",
      "local_ip": "192.168.2.2",
      "neighbor_ip": "192.168.2.3"
    },
    {
      "neighbor_type": "L2",
      "local_ip": "192.168.3.2",
      "neighbor_ip": "192.168.3.3"
    },
    {
      "neighbor_type": "L2",
      "local_ip": "192.168.3.2",
      "neighbor_ip": "192.168.3.4"
    },
    {
      "neighbor_type": "L2",
      "local_ip": "192.168.3.3",
      "neighbor_ip": "192.168.3.4"
    },
    {
      "neighbor_type": "L3",
      "local_ip": "192.168.2.2",
      "neighbor_ip": "192.168.3.3"
    },
    {
      "neighbor_type": "L3",
      "local_ip": "192.168.2.2",
      "neighbor_ip": "192.168.3.2"
    },
    {
      "neighbor_type": "L3",
      "local_ip": "192.168.2.2",
      "neighbor_ip": "192.168.3.4"
    },
    {
      "neighbor_type": "L3",
      "local_ip": "192.168.2.3",
      "neighbor_ip": "192.168.3.3"
    },
    {
      "neighbor_type": "L3",
      "local_ip": "192.168.2.3",
      "neighbor_ip": "192.168.3.2"
    },
    {
      "neighbor_type": "L3",
      "local_ip": "192.168.2.3",
      "neighbor_ip": "192.168.3.4"
    }
  ],
  "neighbor_info": [],
  "routers_internal": [
    {
      "operation_type": "CREATE",
      "configuration": {
        "format_version": 1,
        "revision_number": 1,
        "request_id": "req-2c7a9f33-709f-4bb7-97f4-7105b20df6a7",
        "id": "64e339bb-1a6c-47bd-9ee7-a0cf81a35172",
        "message_type": "FULL",
        "host_dvr_mac": "AA-BB-CC-A9-0F-EC",
        "subnet_routing_tables": [
          {
            "subnet_id": "a87e0f87-a2d9-44ef-9194-9a62f178594f",
            "routing_rules": [
             {
                "operation_type": "CREATE",
                "id": "3dda2801-d675-4688-a63f-dcda8d327f50",
                "name": "rule1",
                "destination": "10.0.2.0/24",
                "next_hop_ip": "10.0.2.1",
                "priority": 100,
                "routing_rule_extra_info": {
                  "destination_type": "INTERNET_GW",
                  "next_hop_mac": "AA-BB-CC-B9-EE-FC"
                }
              }
            ]
          }
          ,
            {
            "subnet_id": "a87e0f87-a2d9-44ef-9194-9a62f178594e",
            "routing_rules": [
              {
                "operation_type": "CREATE",
                "id": "3dda2801-d675-4688-a63f-dcda8d327f51",
                "name": "rule2",
                "destination": "10.0.3.0/24",
                "next_hop_ip": "10.0.3.1",
                "priority": 100,
                "routing_rule_extra_info": {
                  "destination_type": "INTERNET_GW",
                  "next_hop_mac": "AA-BB-CC-B9-EE-FF"
                }
              }
            ]
          }
        ]
      }
    }
  ],
  "ports_internal": [
    {
      "project_id": "3dda2801-d675-4688-a63f-dcda8d327f50",
      "id": "f37810eb-7f83-45fa-a4d4-1b31e75399d3",
      "name": "test_cni_port2",
      "description": "",
      "binding_host_ip": "10.213.43.187",
      "vpc_id": "9192a4d4-ffff-4ece-b3f0-8d36e3d88038",
      "tenant_id": null,
      "admin_state_up": true,
      "mac_address": "86:ea:77:ad:52:55",
      "veth_name": "veth0",
      "device_id": null,
      "device_owner": null,
      "status": null,
      "neighbor_host_ip": null,
      "fixed_ips": [
        {
          "ip_address": "192.168.2.2",
          "subnet_id": "a87e0f87-a2d9-44ef-9194-9a62f178594f"
        }
      ],
      "allowed_address_pairs": null,
      "extra_dhcp_opts": null,
      "security_groups": null,
      "binding:host_id": "ephost_0",
      "binding:profile": null,
      "binding:vnic_type": null,
      "network_ns": "/var/run/netns/test_netw_ns",
      "dnsName": null,
      "dnsAssignment": null,
      "fast_path": true
    },
    {
      "project_id": "3dda2801-d675-4688-a63f-dcda8d327f50",
      "id": "f37810eb-7f83-45fa-a4d4-1b31e75399d2",
      "name": "test_cni_port1",
      "description": "",
      "binding_host_ip": "10.213.43.187",
      "vpc_id": "9192a4d4-ffff-4ece-b3f0-8d36e3d88038",
      "tenant_id": null,
      "admin_state_up": true,
      "mac_address": "86:ea:77:ad:52:56",
      "veth_name": "veth0",
      "device_id": null,
      "device_owner": null,
      "status": null,
      "neighbor_host_ip": null,
      "fixed_ips": [
        {
          "ip_address": "192.168.3.4",
          "subnet_id": "a87e0f87-a2d9-44ef-9194-9a62f178594e"
        }
      ],
      "allowed_address_pairs": null,
      "extra_dhcp_opts": null,
      "security_groups": null,
      "binding:host_id": "ephost_0",
      "binding:profile": null,
      "binding:vnic_type": null,
      "network_ns": "/var/run/netns/test_netw_ns",
      "dnsName": null,
      "dnsAssignment": null,
      "fast_path": true
    },
    {
      "project_id": "3dda2801-d675-4688-a63f-dcda8d327f50",
      "id": "f37810eb-7f83-45fa-a4d4-1b31e75399d6",
      "name": "test_cni_port4",
      "description": "",
      "binding_host_ip": "10.213.43.163",
      "vpc_id": "9192a4d4-ffff-4ece-b3f0-8d36e3d88038",
      "tenant_id": null,
      "admin_state_up": true,
      "mac_address": "86:ea:77:ad:52:57",
      "veth_name": "veth0",
      "device_id": null,
      "device_owner": null,
      "status": null,
      "fixed_ips": [
        {
          "ip_address": "192.168.3.2",
          "subnet_id": "a87e0f87-a2d9-44ef-9194-9a62f178594e"
        }
      ],
      "allowed_address_pairs": null,
      "extra_dhcp_opts": null,
      "security_groups": null,
      "binding:host_id": "ephost_1",
      "binding:profile": null,
      "binding:vnic_type": null,
      "network_ns": "/var/run/netns/test_netw_ns",
      "dnsName": null,
      "dnsAssignment": null,
      "fast_path": true
    },
    {
      "project_id": "3dda2801-d675-4688-a63f-dcda8d327f50",
      "id": "f37810eb-7f83-45fa-a4d4-1b31e75399d7",
      "name": "test_cni_port5",
      "description": "",
      "binding_host_ip": "10.213.43.163",
      "vpc_id": "9192a4d4-ffff-4ece-b3f0-8d36e3d88038",
      "tenant_id": null,
      "admin_state_up": true,
      "mac_address": "86:ea:77:ad:52:58",
      "veth_name": "veth0",
      "device_id": null,
      "device_owner": null,
      "status": null,
      "fixed_ips": [
        {
          "ip_address": "192.168.3.3",
          "subnet_id": "a87e0f87-a2d9-44ef-9194-9a62f178594e"
        },
        {
          "ip_address": "192.168.2.3",
          "subnet_id": "a87e0f87-a2d9-44ef-9194-9a62f178594f"
        }
      ],
      "allowed_address_pairs": null,
      "extra_dhcp_opts": null,
      "security_groups": null,
      "binding:host_id": "ephost_1",
      "binding:profile": null,
      "binding:vnic_type": null,
      "network_ns": "/var/run/netns/test_netw_ns",
      "dnsName": null,
      "dnsAssignment": null,
      "fast_path": true
    }
  ],
  "security_groups_internal": [
    {}
  ]
}
2.It would generate output:
10.213.43.187=subnet_states {
  operation_type: INFO
  configuration {
    format_version: 1
    id: "a87e0f87-a2d9-44ef-9194-9a62f178594f"
    project_id: "3dda2801-d675-4688-a63f-dcda8d327f50"
    vpc_id: "9192a4d4-ffff-4ece-b3f0-8d36e3d88038"
    cidr: "192.168.2.0/24"
  }
}
subnet_states {
  operation_type: INFO
  configuration {
    format_version: 1
    id: "a87e0f87-a2d9-44ef-9194-9a62f178594e"
    project_id: "3dda2801-d675-4688-a63f-dcda8d327f50"
    vpc_id: "9192a4d4-ffff-4ece-b3f0-8d36e3d88038"
    cidr: "192.168.3.0/24"
  }
}
port_states {
  configuration {
    format_version: 1
    revision_number: 1
    id: "f37810eb-7f83-45fa-a4d4-1b31e75399d3"
    message_type: FULL
    project_id: "3dda2801-d675-4688-a63f-dcda8d327f50"
    vpc_id: "9192a4d4-ffff-4ece-b3f0-8d36e3d88038"
    name: "test_cni_port2"
    mac_address: "86:ea:77:ad:52:55"
    admin_state_up: true
  }
}
port_states {
  configuration {
    format_version: 1
    revision_number: 1
    id: "f37810eb-7f83-45fa-a4d4-1b31e75399d2"
    message_type: FULL
    project_id: "3dda2801-d675-4688-a63f-dcda8d327f50"
    vpc_id: "9192a4d4-ffff-4ece-b3f0-8d36e3d88038"
    name: "test_cni_port1"
    mac_address: "86:ea:77:ad:52:56"
    admin_state_up: true
  }
}
neighbor_states {
  configuration {
    format_version: 1
    revision_number: 2
    id: "f37810eb-7f83-45fa-a4d4-1b31e75399d3"
    project_id: "3dda2801-d675-4688-a63f-dcda8d327f50"
    vpc_id: "9192a4d4-ffff-4ece-b3f0-8d36e3d88038"
    name: "test_cni_port2"
    mac_address: "86:ea:77:ad:52:55"
    host_ip_address: "10.213.43.187"
    fixed_ips {
      neighbor_type: L3
      subnet_id: "a87e0f87-a2d9-44ef-9194-9a62f178594f"
      ip_address: "192.168.2.2"
    }
  }
}
neighbor_states {
  configuration {
    format_version: 1
    revision_number: 2
    id: "f37810eb-7f83-45fa-a4d4-1b31e75399d7"
    project_id: "3dda2801-d675-4688-a63f-dcda8d327f50"
    vpc_id: "9192a4d4-ffff-4ece-b3f0-8d36e3d88038"
    name: "test_cni_port5"
    mac_address: "86:ea:77:ad:52:58"
    host_ip_address: "10.213.43.163"
    fixed_ips {
      neighbor_type: L3
      subnet_id: "a87e0f87-a2d9-44ef-9194-9a62f178594f"
      ip_address: "192.168.2.3"
    }
  }
}
neighbor_states {
  configuration {
    format_version: 1
    revision_number: 2
    id: "f37810eb-7f83-45fa-a4d4-1b31e75399d2"
    project_id: "3dda2801-d675-4688-a63f-dcda8d327f50"
    vpc_id: "9192a4d4-ffff-4ece-b3f0-8d36e3d88038"
    name: "test_cni_port1"
    mac_address: "86:ea:77:ad:52:56"
    host_ip_address: "10.213.43.187"
    fixed_ips {
      neighbor_type: L3
      subnet_id: "a87e0f87-a2d9-44ef-9194-9a62f178594e"
      ip_address: "192.168.3.4"
    }
  }
}
neighbor_states {
  configuration {
    format_version: 1
    revision_number: 2
    id: "f37810eb-7f83-45fa-a4d4-1b31e75399d6"
    project_id: "3dda2801-d675-4688-a63f-dcda8d327f50"
    vpc_id: "9192a4d4-ffff-4ece-b3f0-8d36e3d88038"
    name: "test_cni_port4"
    mac_address: "86:ea:77:ad:52:57"
    host_ip_address: "10.213.43.163"
    fixed_ips {
      neighbor_type: L3
      subnet_id: "a87e0f87-a2d9-44ef-9194-9a62f178594e"
      ip_address: "192.168.3.2"
    }
  }
}
neighbor_states {
  configuration {
    format_version: 1
    revision_number: 2
    id: "f37810eb-7f83-45fa-a4d4-1b31e75399d7"
    project_id: "3dda2801-d675-4688-a63f-dcda8d327f50"
    vpc_id: "9192a4d4-ffff-4ece-b3f0-8d36e3d88038"
    name: "test_cni_port5"
    mac_address: "86:ea:77:ad:52:58"
    host_ip_address: "10.213.43.163"
    fixed_ips {
      neighbor_type: L3
      subnet_id: "a87e0f87-a2d9-44ef-9194-9a62f178594e"
      ip_address: "192.168.3.3"
    }
  }
}
security_group_states {
  configuration {
  }
}
dhcp_states {
  configuration {
    format_version: 1
    revision_number: 1
    subnet_id: "a87e0f87-a2d9-44ef-9194-9a62f178594f"
    mac_address: "86:ea:77:ad:52:55"
    ipv4_address: "192.168.2.2"
  }
}
dhcp_states {
  configuration {
    format_version: 1
    revision_number: 1
    subnet_id: "a87e0f87-a2d9-44ef-9194-9a62f178594e"
    mac_address: "86:ea:77:ad:52:56"
    ipv4_address: "192.168.3.4"
  }
}
router_states {
  configuration {
    format_version: 1
    revision_number: 1
    id: "64e339bb-1a6c-47bd-9ee7-a0cf81a35172"
    message_type: FULL
    host_dvr_mac_address: "AA-BB-CC-A9-0F-EC"
    subnet_routing_tables {
      subnet_id: "a87e0f87-a2d9-44ef-9194-9a62f178594f"
      routing_rules {
        id: "3dda2801-d675-4688-a63f-dcda8d327f50"
        name: "rule1"
        destination: "10.0.2.0/24"
        next_hop_ip: "10.0.2.1"
        priority: 100
        routing_rule_extra_info {
          next_hop_mac: "AA-BB-CC-B9-EE-FC"
        }
      }
    }
    subnet_routing_tables {
      subnet_id: "a87e0f87-a2d9-44ef-9194-9a62f178594e"
      routing_rules {
        id: "3dda2801-d675-4688-a63f-dcda8d327f51"
        name: "rule2"
        destination: "10.0.3.0/24"
        next_hop_ip: "10.0.3.1"
        priority: 100
        routing_rule_extra_info {
          next_hop_mac: "AA-BB-CC-B9-EE-FF"
        }
      }
    }
  }
}
, 10.213.43.163=subnet_states {
  operation_type: INFO
  configuration {
    format_version: 1
    id: "a87e0f87-a2d9-44ef-9194-9a62f178594f"
    project_id: "3dda2801-d675-4688-a63f-dcda8d327f50"
    vpc_id: "9192a4d4-ffff-4ece-b3f0-8d36e3d88038"
    cidr: "192.168.2.0/24"
  }
}
subnet_states {
  operation_type: INFO
  configuration {
    format_version: 1
    id: "a87e0f87-a2d9-44ef-9194-9a62f178594e"
    project_id: "3dda2801-d675-4688-a63f-dcda8d327f50"
    vpc_id: "9192a4d4-ffff-4ece-b3f0-8d36e3d88038"
    cidr: "192.168.3.0/24"
  }
}
port_states {
  configuration {
    format_version: 1
    revision_number: 1
    id: "f37810eb-7f83-45fa-a4d4-1b31e75399d7"
    message_type: FULL
    project_id: "3dda2801-d675-4688-a63f-dcda8d327f50"
    vpc_id: "9192a4d4-ffff-4ece-b3f0-8d36e3d88038"
    name: "test_cni_port5"
    mac_address: "86:ea:77:ad:52:58"
    admin_state_up: true
  }
}
port_states {
  configuration {
    format_version: 1
   revision_number: 1
    id: "f37810eb-7f83-45fa-a4d4-1b31e75399d6"
    message_type: FULL
    project_id: "3dda2801-d675-4688-a63f-dcda8d327f50"
    vpc_id: "9192a4d4-ffff-4ece-b3f0-8d36e3d88038"
    name: "test_cni_port4"
    mac_address: "86:ea:77:ad:52:57"
    admin_state_up: true
  }
}
neighbor_states {
  configuration {
    format_version: 1
    revision_number: 2
    id: "f37810eb-7f83-45fa-a4d4-1b31e75399d3"
    project_id: "3dda2801-d675-4688-a63f-dcda8d327f50"
    vpc_id: "9192a4d4-ffff-4ece-b3f0-8d36e3d88038"
    name: "test_cni_port2"
    mac_address: "86:ea:77:ad:52:55"
    host_ip_address: "10.213.43.187"
    fixed_ips {
      neighbor_type: L3
      subnet_id: "a87e0f87-a2d9-44ef-9194-9a62f178594f"
      ip_address: "192.168.2.2"
    }
  }
}
neighbor_states {
  configuration {
    format_version: 1
    revision_number: 2
    id: "f37810eb-7f83-45fa-a4d4-1b31e75399d7"
    project_id: "3dda2801-d675-4688-a63f-dcda8d327f50"
    vpc_id: "9192a4d4-ffff-4ece-b3f0-8d36e3d88038"
    name: "test_cni_port5"
    mac_address: "86:ea:77:ad:52:58"
    host_ip_address: "10.213.43.163"
    fixed_ips {
      neighbor_type: L3
      subnet_id: "a87e0f87-a2d9-44ef-9194-9a62f178594f"
      ip_address: "192.168.2.3"
    }
  }
}
neighbor_states {
  configuration {
    format_version: 1
    revision_number: 2
    id: "f37810eb-7f83-45fa-a4d4-1b31e75399d2"
    project_id: "3dda2801-d675-4688-a63f-dcda8d327f50"
    vpc_id: "9192a4d4-ffff-4ece-b3f0-8d36e3d88038"
    name: "test_cni_port1"
    mac_address: "86:ea:77:ad:52:56"
    host_ip_address: "10.213.43.187"
    fixed_ips {
      neighbor_type: L3
      subnet_id: "a87e0f87-a2d9-44ef-9194-9a62f178594e"
      ip_address: "192.168.3.4"
    }
  }
}
neighbor_states {
  configuration {
    format_version: 1
    revision_number: 2
    id: "f37810eb-7f83-45fa-a4d4-1b31e75399d6"
    project_id: "3dda2801-d675-4688-a63f-dcda8d327f50"
    vpc_id: "9192a4d4-ffff-4ece-b3f0-8d36e3d88038"
    name: "test_cni_port4"
    mac_address: "86:ea:77:ad:52:57"
    host_ip_address: "10.213.43.163"
    fixed_ips {
      neighbor_type: L3
      subnet_id: "a87e0f87-a2d9-44ef-9194-9a62f178594e"
      ip_address: "192.168.3.2"
    }
  }
}
neighbor_states {
  configuration {
    format_version: 1
    revision_number: 2
    id: "f37810eb-7f83-45fa-a4d4-1b31e75399d7"
    project_id: "3dda2801-d675-4688-a63f-dcda8d327f50"
    vpc_id: "9192a4d4-ffff-4ece-b3f0-8d36e3d88038"
    name: "test_cni_port5"
    mac_address: "86:ea:77:ad:52:58"
    host_ip_address: "10.213.43.163"
    fixed_ips {
      neighbor_type: L3
      subnet_id: "a87e0f87-a2d9-44ef-9194-9a62f178594e"
      ip_address: "192.168.3.3"
    }
  }
}
security_group_states {
  configuration {
  }
}
dhcp_states {
  configuration {
    format_version: 1
    revision_number: 1
    subnet_id: "a87e0f87-a2d9-44ef-9194-9a62f178594e"
    mac_address: "86:ea:77:ad:52:58"
    ipv4_address: "192.168.3.3"
  }
}
dhcp_states {
  configuration {
    format_version: 1
    revision_number: 1
    subnet_id: "a87e0f87-a2d9-44ef-9194-9a62f178594f"
    mac_address: "86:ea:77:ad:52:58"
    ipv4_address: "192.168.2.3"
  }
}
dhcp_states {
  configuration {
    format_version: 1
    revision_number: 1
    subnet_id: "a87e0f87-a2d9-44ef-9194-9a62f178594e"
    mac_address: "86:ea:77:ad:52:57"
    ipv4_address: "192.168.3.2"
  }
}
router_states {
  configuration {
    format_version: 1
    revision_number: 1
    id: "64e339bb-1a6c-47bd-9ee7-a0cf81a35172"
    message_type: FULL
    host_dvr_mac_address: "AA-BB-CC-A9-0F-EC"
    subnet_routing_tables {
      subnet_id: "a87e0f87-a2d9-44ef-9194-9a62f178594f"
      routing_rules {
        id: "3dda2801-d675-4688-a63f-dcda8d327f50"
        name: "rule1"
        destination: "10.0.2.0/24"
        next_hop_ip: "10.0.2.1"
        priority: 100
        routing_rule_extra_info {
          next_hop_mac: "AA-BB-CC-B9-EE-FC"
        }
      }
    }
    subnet_routing_tables {
      subnet_id: "a87e0f87-a2d9-44ef-9194-9a62f178594e"
      routing_rules {
        id: "3dda2801-d675-4688-a63f-dcda8d327f51"
        name: "rule2"
        destination: "10.0.3.0/24"
        next_hop_ip: "10.0.3.1"
        priority: 100
        routing_rule_extra_info {
          next_hop_mac: "AA-BB-CC-B9-EE-FF"
        }
      }
    }
  }
}
]
3.With the payload to dpm to add one ip to existing port:
{
  "vpcs_internal": [
    {
      "project_id": "3dda2801-d675-4688-a63f-dcda8d327f50",
      "id": "9192a4d4-ffff-4ece-b3f0-8d36e3d88038",
      "name": "test_vpc",
      "description": "",
      "cidr": "192.168.0.0/16"
    }
  ],
  "subnets_internal": [
    {
      "project_id": "3dda2801-d675-4688-a63f-dcda8d327f50",
      "network_id": "9192a4d4-ffff-4ece-b3f0-8d36e3d88038",
      "id": "a87e0f87-a2d9-44ef-9194-9a62f178594f",
      "name": "test_subnet2",
      "description": "",
      "cidr": "192.168.2.0/24",
      "gateway_ip": "192.168.2.1",
      "availability_zone": "uswest-1",
      "dhcp_enable": false,
      "primary_dns": null,
      "secondary_dns": null,
      "dns_list": null,
      "tunnel_id": "88889",
      "gatewayMacs": "96:ea:77:ad:52:55"
    },
    {
      "project_id": "3dda2801-d675-4688-a63f-dcda8d327f50",
      "network_id": "9192a4d4-ffff-4ece-b3f0-8d36e3d88038",
      "id": "a87e0f87-a2d9-44ef-9194-9a62f178594e",
      "name": "test_subnet3",
      "description": "",
      "cidr": "192.168.3.0/24",
      "gateway_ip": "192.168.3.1",
      "availability_zone": "uswest-1",
      "dhcp_enable": false,
      "primary_dns": null,
      "secondary_dns": null,
      "dns_list": null,
      "tunnel_id": "88888",
      "gatewayMacs": "96:ea:77:ad:52:54"
    }
  ],
  "neighbor_table": [
    {
      "neighbor_type": "L2",
      "local_ip": "192.168.3.5",
      "neighbor_ip": "192.168.3.4"
    },
    {
      "neighbor_type": "L2",
      "local_ip": "192.168.3.5",
      "neighbor_ip": "192.168.3.3"
    },
    {
      "neighbor_type": "L2",
      "local_ip": "192.168.3.5",
      "neighbor_ip": "192.168.3.2"
    },
    {
      "neighbor_type": "L3",
      "local_ip": "192.168.2.5",
      "neighbor_ip": "192.168.2.3"
    },
    {
      "neighbor_type": "L3",
      "local_ip": "192.168.3.5",
      "neighbor_ip": "192.168.2.2"
    }
  ],
  "neighbor_info": [
    {
      "port_id": "f37810eb-7f83-45fa-a4d4-1b31e75399d3",
      "host_ip": "10.213.43.187",
      "host_id": "ephost_0",
     "vpc_id": "9192a4d4-ffff-4ece-b3f0-8d36e3d88038",
      "port_ip": "192.168.2.2",
      "subnet_id": "a87e0f87-a2d9-44ef-9194-9a62f178594f",
     "port_mac": "86:ea:77:ad:52:55"
    },
    {
      "port_id": "f37810eb-7f83-45fa-a4d4-1b31e75399d6",
      "host_ip": "10.213.43.163",
      "host_id": "ephost_1",
      "vpc_id": "9192a4d4-ffff-4ece-b3f0-8d36e3d88038",
      "port_ip": "192.168.3.2",
      "subnet_id": "a87e0f87-a2d9-44ef-9194-9a62f178594e",
      "port_mac": "86:ea:77:ad:52:57"
    },
    {
      "port_id": "f37810eb-7f83-45fa-a4d4-1b31e75399d7",
      "host_ip": "10.213.43.163",
      "host_id": "ephost_1",
      "vpc_id": "9192a4d4-ffff-4ece-b3f0-8d36e3d88038",
      "port_ip": "192.168.2.3",
      "subnet_id": "a87e0f87-a2d9-44ef-9194-9a62f178594f",
      "port_mac": "86:ea:77:ad:52:58"
    },
    {
      "port_id": "f37810eb-7f83-45fa-a4d4-1b31e75399d7",
      "host_ip": "10.213.43.163",
      "host_id": "ephost_1",
      "vpc_id": "9192a4d4-ffff-4ece-b3f0-8d36e3d88038",
      "port_ip": "192.168.3.3",
      "subnet_id": "a87e0f87-a2d9-44ef-9194-9a62f178594e",
      "port_mac": "86:ea:77:ad:52:58"
    },
    {
      "port_id": "f37810eb-7f83-45fa-a4d4-1b31e75399d2",
      "host_ip": "10.213.43.187",
      "host_id": "ephost_1",
      "vpc_id": "9192a4d4-ffff-4ece-b3f0-8d36e3d88038",
      "port_ip": "192.168.3.4",
      "subnet_id": "a87e0f87-a2d9-44ef-9194-9a62f178594e",
      "port_mac": "86:ea:77:ad:52:55"
    }
  ],
  "routers_internal": [
    {
      "operation_type": "CREATE",
      "configuration": {
        "format_version": 1,
        "revision_number": 1,
        "request_id": "req-2c7a9f33-709f-4bb7-97f4-7105b20df6a7",
        "id": "64e339bb-1a6c-47bd-9ee7-a0cf81a35172",
        "message_type": "FULL",
        "host_dvr_mac": "AA-BB-CC-A9-0F-EC",
        "subnet_routing_tables": [
          {
            "subnet_id": "a87e0f87-a2d9-44ef-9194-9a62f178594f",
            "routing_rules": [
              {
                "operation_type": "CREATE",
                "id": "3dda2801-d675-4688-a63f-dcda8d327f50",
                "name": "rule1",
                "destination": "10.0.2.0/24",
                "next_hop_ip": "10.0.2.1",
                "priority": 100,
                "routing_rule_extra_info": {
                  "destination_type": "INTERNET_GW",
                  "next_hop_mac": "AA-BB-CC-B9-EE-FC"
                }
              }
            ]
          }
          ,
            {
            "subnet_id": "a87e0f87-a2d9-44ef-9194-9a62f178594e",
            "routing_rules": [
              {
                "operation_type": "CREATE",
                "id": "3dda2801-d675-4688-a63f-dcda8d327f51",
                "name": "rule2",
                "destination": "10.0.3.0/24",
                "next_hop_ip": "10.0.3.1",
                "priority": 100,
                "routing_rule_extra_info": {
                  "destination_type": "INTERNET_GW",
                  "next_hop_mac": "AA-BB-CC-B9-EE-FF"
                }
              }
            ]
          }
        ]
      }
    }
  ],
"ports_internal": [
    {
      "project_id": "3dda2801-d675-4688-a63f-dcda8d327f50",
      "id": "f37810eb-7f83-45fa-a4d4-1b31e75399d3",
      "name": "test_cni_port5",
      "description": "",
      "binding_host_ip": "10.213.43.187",
      "vpc_id": "9192a4d4-ffff-4ece-b3f0-8d36e3d88038",
      "tenant_id": null,
      "admin_state_up": true,
      "mac_address": "86:ea:77:ad:52:55",
      "veth_name": "veth0",
      "device_id": null,
      "device_owner": null,
      "status": null,
      "fixed_ips": [
        {
          "ip_address": "192.168.3.5",
          "subnet_id": "a87e0f87-a2d9-44ef-9194-9a62f178594e"
        }
      ],
      "allowed_address_pairs": null,
      "extra_dhcp_opts": null,
      "security_groups": null,
      "binding:host_id": "ephost_1",
      "binding:profile": null,
      "binding:vnic_type": null,
      "network_ns": "/var/run/netns/test_netw_ns",
      "dnsName": null,
      "dnsAssignment": null,
      "fast_path": true
    }
  ],
  "security_groups_internal": [
    {}
  ]
}
4.It would generate the output:
10.213.43.187=subnet_states {
  operation_type: INFO
  configuration {
    format_version: 1
    id: "a87e0f87-a2d9-44ef-9194-9a62f178594f"
    project_id: "3dda2801-d675-4688-a63f-dcda8d327f50"
    vpc_id: "9192a4d4-ffff-4ece-b3f0-8d36e3d88038"
    cidr: "192.168.2.0/24"
  }
}
subnet_states {
  operation_type: INFO
  configuration {
    format_version: 1
    id: "a87e0f87-a2d9-44ef-9194-9a62f178594e"
    project_id: "3dda2801-d675-4688-a63f-dcda8d327f50"
    vpc_id: "9192a4d4-ffff-4ece-b3f0-8d36e3d88038"
    cidr: "192.168.3.0/24"
  }
}
port_states {
  configuration {
    format_version: 1
    revision_number: 1
    id: "f37810eb-7f83-45fa-a4d4-1b31e75399d3"
    message_type: FULL
    project_id: "3dda2801-d675-4688-a63f-dcda8d327f50"
    vpc_id: "9192a4d4-ffff-4ece-b3f0-8d36e3d88038"
    name: "test_cni_port5"
    mac_address: "86:ea:77:ad:52:55"
    admin_state_up: true
  }
}
neighbor_states {
  configuration {
    format_version: 1
    revision_number: 2
    id: "f37810eb-7f83-45fa-a4d4-1b31e75399d3"
    project_id: "3dda2801-d675-4688-a63f-dcda8d327f50"
    vpc_id: "9192a4d4-ffff-4ece-b3f0-8d36e3d88038"
    name: "test_cni_port5"
    mac_address: "86:ea:77:ad:52:55"
    host_ip_address: "10.213.43.187"
    fixed_ips {
      neighbor_type: L3
      subnet_id: "a87e0f87-a2d9-44ef-9194-9a62f178594e"
      ip_address: "192.168.3.5"
    }
  }
}
neighbor_states {
  configuration {
    format_version: 1
    revision_number: 2
    id: "f37810eb-7f83-45fa-a4d4-1b31e75399d3"
    project_id: "3dda2801-d675-4688-a63f-dcda8d327f50"
    vpc_id: "9192a4d4-ffff-4ece-b3f0-8d36e3d88038"
    name: "test_cni_port5"
    mac_address: "86:ea:77:ad:52:55"
    host_ip_address: "10.213.43.187"
    fixed_ips {
      neighbor_type: L3
      subnet_id: "a87e0f87-a2d9-44ef-9194-9a62f178594f"
      ip_address: "192.168.2.2"
    }
  }
}
neighbor_states {
  configuration {
    format_version: 1
    revision_number: 2
    id: "f37810eb-7f83-45fa-a4d4-1b31e75399d7"
    project_id: "3dda2801-d675-4688-a63f-dcda8d327f50"
    vpc_id: "9192a4d4-ffff-4ece-b3f0-8d36e3d88038"
    name: "test_cni_port5"
    mac_address: "86:ea:77:ad:52:58"
    host_ip_address: "10.213.43.163"
    fixed_ips {
      neighbor_type: L3
      subnet_id: "a87e0f87-a2d9-44ef-9194-9a62f178594f"
      ip_address: "192.168.2.3"
    }
  }
}
neighbor_states {
  configuration {
    format_version: 1
    revision_number: 2
    id: "f37810eb-7f83-45fa-a4d4-1b31e75399d6"
    project_id: "3dda2801-d675-4688-a63f-dcda8d327f50"
    vpc_id: "9192a4d4-ffff-4ece-b3f0-8d36e3d88038"
    name: "test_cni_port4"
    mac_address: "86:ea:77:ad:52:57"
    host_ip_address: "10.213.43.163"
    fixed_ips {
      subnet_id: "a87e0f87-a2d9-44ef-9194-9a62f178594e"
      ip_address: "192.168.3.2"
    }
  }
}
neighbor_states {
  configuration {
    format_version: 1
    revision_number: 2
    id: "f37810eb-7f83-45fa-a4d4-1b31e75399d7"
    project_id: "3dda2801-d675-4688-a63f-dcda8d327f50"
    vpc_id: "9192a4d4-ffff-4ece-b3f0-8d36e3d88038"
    name: "test_cni_port5"
    mac_address: "86:ea:77:ad:52:58"
    host_ip_address: "10.213.43.163"
    fixed_ips {
      subnet_id: "a87e0f87-a2d9-44ef-9194-9a62f178594e"
      ip_address: "192.168.3.3"
    }
  }
}
security_group_states {
  configuration {
  }
}
router_states {
  configuration {
    format_version: 1
    revision_number: 1
    id: "64e339bb-1a6c-47bd-9ee7-a0cf81a35172"
    message_type: FULL
    host_dvr_mac_address: "AA-BB-CC-A9-0F-EC"
    subnet_routing_tables {
      subnet_id: "a87e0f87-a2d9-44ef-9194-9a62f178594f"
      routing_rules {
        id: "3dda2801-d675-4688-a63f-dcda8d327f50"
        name: "rule1"
        destination: "10.0.2.0/24"
        next_hop_ip: "10.0.2.1"
        priority: 100
        routing_rule_extra_info {
          next_hop_mac: "AA-BB-CC-B9-EE-FC"
        }
      }
    }
    subnet_routing_tables {
      subnet_id: "a87e0f87-a2d9-44ef-9194-9a62f178594e"
      routing_rules {
        id: "3dda2801-d675-4688-a63f-dcda8d327f51"
        name: "rule2"
        destination: "10.0.3.0/24"
        next_hop_ip: "10.0.3.1"
        priority: 100
        routing_rule_extra_info {
          next_hop_mac: "AA-BB-CC-B9-EE-FF"
        }
      }
    }
  }
}
, 10.213.43.163=subnet_states {
  operation_type: INFO
  configuration {
    format_version: 1
    id: "a87e0f87-a2d9-44ef-9194-9a62f178594f"
    project_id: "3dda2801-d675-4688-a63f-dcda8d327f50"
    vpc_id: "9192a4d4-ffff-4ece-b3f0-8d36e3d88038"
    cidr: "192.168.2.0/24"
  }
}
subnet_states {
  operation_type: INFO
  configuration {
    format_version: 1
    id: "a87e0f87-a2d9-44ef-9194-9a62f178594e"
    project_id: "3dda2801-d675-4688-a63f-dcda8d327f50"
    vpc_id: "9192a4d4-ffff-4ece-b3f0-8d36e3d88038"
    cidr: "192.168.3.0/24"
  }
}
neighbor_states {
  configuration {
    format_version: 1
    revision_number: 2
    id: "f37810eb-7f83-45fa-a4d4-1b31e75399d3"
    project_id: "3dda2801-d675-4688-a63f-dcda8d327f50"
    vpc_id: "9192a4d4-ffff-4ece-b3f0-8d36e3d88038"
    name: "test_cni_port5"
    mac_address: "86:ea:77:ad:52:55"
    host_ip_address: "10.213.43.187"
    fixed_ips {
      neighbor_type: L3
      subnet_id: "a87e0f87-a2d9-44ef-9194-9a62f178594e"
      ip_address: "192.168.3.5"
    }
  }
}
security_group_states {
  configuration {
  }
}
router_states {
  configuration {
    format_version: 1
    revision_number: 1
    id: "64e339bb-1a6c-47bd-9ee7-a0cf81a35172"
    message_type: FULL
    host_dvr_mac_address: "AA-BB-CC-A9-0F-EC"
    subnet_routing_tables {
      subnet_id: "a87e0f87-a2d9-44ef-9194-9a62f178594f"
      routing_rules {
        id: "3dda2801-d675-4688-a63f-dcda8d327f50"
        name: "rule1"
        destination: "10.0.2.0/24"
        next_hop_ip: "10.0.2.1"
        priority: 100
        routing_rule_extra_info {
          next_hop_mac: "AA-BB-CC-B9-EE-FC"
        }
      }
    }
    subnet_routing_tables {
      subnet_id: "a87e0f87-a2d9-44ef-9194-9a62f178594e"
      routing_rules {
        id: "3dda2801-d675-4688-a63f-dcda8d327f51"
        name: "rule2"
        destination: "10.0.3.0/24"
        next_hop_ip: "10.0.3.1"
        priority: 100
        routing_rule_extra_info {
          next_hop_mac: "AA-BB-CC-B9-EE-FF"
        }
      }
    }
  }
}
]
xieus commented 3 years ago

With the L3 support, we will close the first item in the issue description.

We will need to look into (2)-(4) as well. @haboy52581

er1cthe0ne commented 3 years ago

We will need to look into (2)-(4) as well. @haboy52581

(2) requires .proto contract change together with DPM change, let's do it after L3 is done. (3) can be look at now (4) requires minor change in ACA to remove the corresponding assert, it is simple but requires new ACA deployment, the change in ACA and completed and merged to master

haboy52581 commented 3 years ago

we need to first finish L3 then come after this