cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
85
Views
0
Helpful
1
Replies

Workflow conditionals with string arrays

Victoria M
Community Member

I'm using network tags for Insight monitoring. During an outage, our team might remove one of those tags so that it doesn't continuously alert for a network that we know is down. However, we won't always remember to reapply the tag after the network is back up.

I'm trying to create a workflow that reapplies those tags to specific networks once a week. Not every network in the organization uses Insight, so I don't want to reapply tags to every network. I have a list of network names that should have the tags, and I've been trying to create a conditional statement around that, but haven't had much luck.

The workflow starts by getting all networks in the organization and then reading name and id into a table. I then have a 'for logic' with an embedded conditional. What I want to do is look at the retrieved network name and then try to wildcard match it with a String Array variable that has the networks we want the tags to reapply to. The intention is to then use a generic API call on the retrieved networkId for each network on the list to reapply specific tags. Unfortunately, it doesn't look like I can select the String Array variable I manually created. It will let me select a regular string variable, but I haven't had much luck getting it to match anything in the variable. I was able to pick the source array that gets populated after getting all networks in the org. 

I'm not very experienced in programming so I'm not sure if I'm going about this the right way or just making it more complicated than it needs to be. Fortunately, everything else seems to work, I just can't get it to match on the list of networks I want to match on! Should I be able to select a manually created string array variable to match on a conditional?

 

1 Reply 1

Interesting use case.  Workflows can certainly be used to automate this in a number of different ways.  I wouldn't try to use a string array in a conditional, and you don't need to use the generic API call to get network tags.  I can think of a few ways to do this.

1. Instead of just removing the Insight tag, swap in a different tag like "Replace me", and then create a workflow that is triggered by a schedule Rule to run once a week that would get all networks with the "Replace me" tag and then remove the "Replace me tag" and add back the original Insight tag.  You could use the Meraki - Get Organizational Networks Atomic, which will take as an optional parameter Query - Tags This will return just the networks with the Query - Tag, so much less operationally complex.  You'll end up with a short list of networks that you would need to remove the one tag and add the other.  The Meraki - Update Network Atomic could be used.
2. Another option is to use the same Meraki - Get Organizational Networks and use the Query - Tags optional parameter.  This will give you a list of networks that are tagged with Insight. Then I'd use a Execute Python Script activity to compare the list of networks that are still tagged and your list of networks that should all be tagged and have the Python code return a list of networks that aren't on both lists.  Don't worry if you aren't familiar with Python.  You can provide two sample lists and your intent to a tool like Chat GPT and it will generate the Python code for you.  Then you would just need to iterate through your reduced list of untagged networks to re-apply your tag.  A for loop with a Meraki - Update Network Atomic would do this.  You would need the Network ID, but the System provided Meraki - Get Network by Name workflow can get this for you.
3. If you just want to iterate through the entire list of networks that should be tagged, you could.  Start with a loop, and then inside, use the Meraki - Get Network by Name workflow to get the Network ID.  This will also return other network information like tags. Then a conditional to check the tags, and if not present, in that logic branch, use a Meraki - Update Network Atmoic to add the tag.
If you haven't already done so, I'd review the Workflows Self-Learning videos 
When using loops, please keep in mind the loop limitations. 
It may be helpful to review the example workflow Select and Schedule Firmware Update by Network Tag this has an example of using the Meraki - Get Organizational Networks and the Query - Tags parameter to create a list of networks with the provided tag.