List only Networks of the tenant selected in Service Dialog

automate
#1

Hi,
I am trying to filter cloud networks based on the tenants selected on in the service dialog. But somehow all the available networks are appearing including both internal and external. I tried to implement the Fog gem but no luck. Here is what i am trying to do. I am creating a heat stack where i pass parameters like network to be used for the instance. and this network should come from the tenant selected from the service dialog. i also want to exclude external network
thanks

#2

Hi,

You could use Expression Methods to list your networks in a dropdown.

Create one instance and one method list_internal_networks as following :

Capture%20d%E2%80%99%C3%A9cran%20du%202019-04-02%2011-11-46

The method is an Expression method with the following data :

For the instance, you just have to call the Automate method newly created :

Now, you can create a dynamic dialog with Test_Domain/Openstack/DynamicDialogs/list_internal_network as entrypoint.
You must have another dropdown named cloud_tenant_id with your tenant list.

#4

Hi,
I did create required methods. but getting some error. If i change data type to string i can see arg1=>$(/#dialog_tenant_name), but when data type is set to integer arg1=>0.

[----] I, [2019-04-04T10:07:17.826331 #7224:4268e88] INFO – : User [admin] with current group ID [1000000000002] name [EvmGroup-super_administrator] [----] I, [2019-04-04T10:07:17.835637 #7224:4268e88] INFO – : Instantiating [/Cloud/Orchestration/Operations/MyDynamicDropDowns/list_internal_networks?MiqServer%3A%3Amiq_server=1000000000001&ServiceTemplate%3A%3Aservice_template=1000000000012&User%3A%3Auser=1000000000001&dialog_network_name=&dialog_tenant_name=1000000000004&object_name=list_internal_networks&vmdb_object_type=service_template] [----] I, [2019-04-04T10:07:17.919172 #7224:4268e88] INFO – : Updated namespace [/Cloud/Orchestration/Operations/MyDynamicDropDowns/list_internal_networks?MiqServer%3A%3Amiq_server=1000000000001&ServiceTemplate%3A%3Aservice_template=1000000000012&User%3A%3Auser=1000000000001&dialog_network_name=&dialog_tenant_name=1000000000004&object_name=list_internal_networks&vmdb_object_type=service_template NXTPoc/Cloud/Orchestration/Operations] [----] I, [2019-04-04T10:07:18.027180 #7224:4268e88] INFO – : Updated namespace [Cloud/Orchestration/Operations/MyDynamicDropDowns/list_internal_networks NXTPoc/Cloud/Orchestration/Operations] [----] I, [2019-04-04T10:07:18.038506 #7224:4268e88] INFO – : Invoking [expression] method [/NXTPoc/Cloud/Orchestration/Operations/MyDynamicDropDowns/list_internal_networks] with inputs [{“arg1”=>0}] [----] E, [2019-04-04T10:07:18.053388 #7224:4268e88] ERROR – : Expression method ends

#5

How do you list your tenant in your dialogs ? Is this a dropdown or a text box ?

Normally, the value of arg1 correspond to the value in your field. In my case, I use a dropdown filled with another expression method.

Here is some doc about Expression Methods : https://manageiq.gitbook.io/mastering-cloudforms-automation-addendum/chapter

Could you screenshot/post your method ?

1 Like
#8

Hi… Thanks it is working small typo issue… due to keyboard language match… However this method does not seem to work with heat stack as the tenant is returned as id of the tenant in cloudforms instead of openstack tenant. where as openstack heat expects either tenant id or name of the tenant in openstack.

#9

Is the Cloud Tenant Selection an expression method too?
you can change the returned value for expression methods, as described here

#10

Hi,
List cloud tenants is not the expression method. But that i am able to convert to send to expression method so that i get the required network list. Which is working. However the network list populated passes the manageiq network-id to heat stack which it does not accept as it expects the name of network which should match with the one in openstack. I will try tomorrow to convert the expression method values to name and see if it works

as of now i am getting this
Invoking [expression] method [/Cloud/Orchestration/Operations/MyDynamicDropDowns/cloud_network_name] with inputs [{“arg1”=>“1000000000008”}]

image

#11

Hi,
According to https://manageiq.gitbook.io/mastering-cloudforms-automation-addendum/chapter#returning-an-alternative-key, you could try to add something like key = name in addition to arg1 in the input parameters.

#12

HI,
Thanks for the help I will give it a try again tomorrow and see if it helps.

Regards
Aijaz