List only Networks of the tenant selected in Service Dialog

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

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.

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

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

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.

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

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

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.

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

Regards
Aijaz

Hello, I have the same needs as I am.
Need to let users choose prviate, public network
Can you tell me how to make a drop down list? Thank you very much.

@damian00705,
In your Service Dialog try naming the dropdown field to: cloud_network
Then use the “Provisioning Scope” tag.
Mark just the private and public network as ALL? But leave the External and Others unmarked.
But of course you will need to tag everything the Tenant/Project can use. Newtork, Storage, flavors, etc.
The Groups will also need access to the Provisioning Scope tag as well.
The tagging is bit of a pain at first.

Hi Bkinney:
How to use dynamic dropdown with tag?
I have tried but can’t display my tag option like public、private network or flavor and other something.

Thank you for help!

I will assume all Tenants are limited to public and private networks.

  1. In the Service Dialog, create a normal Dropdown element.
  2. Edit that Dropdown.
  3. In the “Field Information” tab change the Name field to: cloud_network
    Note: This doesn’t need to be Dynamic.
  4. Save the changes to the Dropdown and then the Service Dialog.

Now you need to set up the “Provisioning Scope” tag with more values.
5. Go to the Administrator | EVM menu in the top right and select “Configuration”.
6. In the Settings accordion click on the CFME Region: Region <#>[#]
7. On the right click on the Tags tab.
8. Click on the “My Company” Tags.
9. Click on the Categories dropdown menu and select: Provisioning Scope
10. Add a new Entry value: AllTenants

I will assume you are grouping by Tenant and each one has their own Group.
So edit the group and allow them access to just the AllTenants value.
11. Click on the Access Control accordion.
12. Click on Groups and click on one Tenant group at a time.
13. Edit the current group. [Configuration] > Edit this Group
14. In the Assign Filters section click on the “My Company” tags.
15. Change the “This user is limited to” field to : Specific Tags
16. Click on the folder labeled: Provisioning Scope
17. Check the AllTenant option.
18. When done Save the changes.

The part that takes time is editing each resource.
Highlight it and from the [Policy] menu select Edit tags.

  1. Go to Networks > Networks.
  2. In the “Cloud Networks” table click on just the private and public networks.
  3. Click on the [Policy] menu and select “Edit Tags”.
  4. Select the Provisioning Scope" tag and change its value to AllTenant.
  5. Click the Save button.

Now continue doing this for all… the resources needed to provision an Instance.
storage, flavors, availability zones, etc.

When a user from that Tenant Group logs in,
they can only use the resources tagged as AllTenant.
Please test this out in a Dev environment until you can provision properly. Or try with a test tenant group only at first.

1 Like