futurewei-cloud / alcor

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

[Contract PM<->DPM] Additional information needed from PM to DPM #435

Open er1cthe0ne opened 3 years ago

er1cthe0ne commented 3 years ago

ACA has the following fields in the contract between DPM <-> ACA. The correct information needs to come from the callers to DPM:

  1. update_type (was named message_type per #386) - DELTA or FULL
  2. revision_number - used to confirm the messages are in order and also for out of order message handling
  3. request_id - each UI or CLI request will be stamped with a request_id, we want to pass request_id in all levels, print it out in our logs for better debugging and troubleshooting experience
xieus commented 3 years ago

Thanks @er1cthe0ne This feature request would be useful as we plan to turn on distributed tracing in Alcor.

xieus commented 3 years ago

We would take our actions in two steps: @haboy52581 Please provide a DPM contract change. @chenpiaoping Please discuss with @haboy52581 to close the change and to make PM change accordingly.

haboy52581 commented 3 years ago

@chenpiaoping to create single port on host1:

{
  "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",
      "gateway_macAddress": "96:ea:77:ad:52:55"
    }
  ],
  "neighbor_table": null,
  "neighbor_info": null,
  "routers_internal": null,
  "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.188",
    "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.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
  }
  ],
  "security_groups_internal": [
    {}
  ]
}

to add port in host1 with different subnet:

{
  "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",
      "gateway_macAddress": "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",
      "gateway_macAddress": "96:ea:77:ad:52:54"
    }
  ],
  "neighbor_table": [
    {
      "neighbor_type": "L3",
      "local_ip": "192.168.3.4",
      "neighbor_ip": "192.168.2.2"
    }
  ],
  "neighbor_info": [
  {
    "port_id": "f37810eb-7f83-45fa-a4d4-1b31e75399d3",
    "host_ip": "10.213.43.188",
    "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"
  }
  ],
  "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-1b31e75399d2",
      "name": "test_cni_port1",
      "description": "",
      "binding_host_ip": "10.213.43.188",
      "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,
      "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
    }
  ],
  "security_groups_internal": [
    {}
  ]
}

to add port on host2:

{
  "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",
      "gateway_macAddress": "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",
      "gateway_macAddress": "96:ea:77:ad:52:54"
    }
  ],
  "neighbor_table": [

    {
      "neighbor_type": "L3",
      "local_ip": "192.168.3.2",
      "neighbor_ip": "192.168.2.2"
    },
    {
      "neighbor_type": "L2",
      "local_ip": "192.168.3.2",
      "neighbor_ip": "192.168.3.4"
    }
  ],
  "neighbor_info": [
  {
    "port_id": "f37810eb-7f83-45fa-a4d4-1b31e75399d3",
    "host_ip": "10.213.43.188",
    "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-1b31e75399d2",
    "host_ip": "10.213.43.188",
    "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-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
    }
  ],
  "security_groups_internal": [
    {}
  ]
}