'Add subport from subport_network to given vm.
:param vm: FakeFullstackMachine instance to with subport should be
added.
:param subport_network: Network object representing network containing
port for subport.'

def add_subport_to_vm(self, vm, subport_network):

    subport = self.safe_client.create_port(self.tenant_id, subport_network.id, mac_address=vm.neutron_port['mac_address'])
    subport_spec = {'port_id': subport['id'], 'segmentation_type': subport_network.segmentation_type, 'segmentation_id': subport_network.tag}
    self.safe_client.trunk_add_subports(self.tenant_id, vm.trunk['id'], [subport_spec])
    ip_network = make_ip_network(subport, subport_network.network)
    vm.add_vlan_interface(subport['mac_address'], ip_network, subport_network.tag)
