#NEWLINE# def create_n1kv_port( self , port , vmnetwork_name , policy_profile , vsm_ip = None ) : #NEWLINE# #INDENT# 'Create a port on the VSM.\n\n        :param port: port dict\n        :param vmnetwork_name: name of the VM network\n        :param policy_profile: policy profile object\n        :param vsm_ip: string representing the IP address of the VSM\n        ' #NEWLINE# body = { #NEWLINE# #INDENT# 'name' : vmnetwork_name , #NEWLINE# 'networkSegmentId' : port [ 'network_id' ] , #NEWLINE# 'networkSegment' : port [ 'network_id' ] , #NEWLINE# 'portProfile' : policy_profile . name , #NEWLINE# 'portProfileId' : policy_profile . id , #NEWLINE# 'tenantId' : port [ 'tenant_id' ] , #NEWLINE# 'portId' : port [ 'id' ] , #NEWLINE# 'macAddress' : port [ 'mac_address' ] , #NEWLINE# 'portType' : port [ 'device_owner' ] , #NEWLINE# #UNINDENT# } #NEWLINE# if port . get ( 'fixed_ips' ) : #NEWLINE# #INDENT# body [ 'ipAddress' ] = port [ 'fixed_ips' ] [ 0 ] [ 'ip_address' ] #NEWLINE# body [ 'subnetId' ] = port [ 'fixed_ips' ] [ 0 ] [ 'subnet_id' ] #NEWLINE# #UNINDENT# return self . _post ( self . vm_networks_path , body = body , vsm_ip = vsm_ip )