Network Switch Pattern Extension

David Casper
Tera Guru

There was a need to have switchport names ('interface_name') to combine the related switch name and the interface name. Ex: Switch01-Eth1/1. This was to allow users to easily identify which switch the port was associated with on certain forms and views. 

This had been addressed as a quick fix by creating a business rule that simply updates the 'interface_name' field whenever it changed. Downside this ran after every discovery for every port. For the time being it worked. It seems that now it is not updating each port and I'm not sure why, but honestly don't really care. 

My original plan was to add a pattern extension to handle this which is cleaner and would reduce the overhead by running a BR so often. I'm no expert with patters but have dabbled. The first thing I learned is apparently temp tables created in the OOB pattern are not available in the extensions. Is this accurate? 

Assuming it is I'm looking for advice as how to best handle this. OOB the port data is stored on a temp table '$switchportsTable' and the interface name come from '$switchportsTable[].ifDescr' (step 27.25) and the switch name comes from the initial payload I believe. 

Do I need to create a new temp table and pretty much copy what the OOB one is accomplishing? All suggestions welcome. Thanks!

4 REPLIES 4

SiD2
ServiceNow Employee
ServiceNow Employee

Hi @David Casper 

 

It's not accurate, the temp tables in the OOB identification section of the pattern will be available in the extension section.

Btw OOB there is no attribute named "interface_name" on the switch CI, so can you let me know where you saw this attribute?

 

Please mark Helpful / Accept Solution so that it helps others with similar questions.

'Interface_name' is on the switchport Ci. Sorry if I typed that up wrong. 

So now I'm curious why I'm not able to see the temp table. Example, I tried creating a transform table step but was unable to see the temp table. When I started typing it, it didn't pull up as it does in the identification section.

SiD2
ServiceNow Employee
ServiceNow Employee

Hi @David Casper 

 

That's strange; it could be some cache/browser issue. Have you been able to check to reopen the pattern again from the log or patterns table and then do debugging? Or try refreshing that page or restarting the browser and all such.

Also, could you check if the temp table is located on the bottom right under the Temporary Variables section while in debug mode? If you couldn't find it either, it is probably not populated due to some issue, and you need to see the previous steps where that temp var is populated.

 

Please mark Helpful / Accept Solution so that it helps others with similar questions.

pratiksha5
Mega Sage

I have updated the network switch pattern to set alias information. You can for sure use the temp tables. Once you go to debug in an extension you should be able to see them on the right side. The trick to do this correctly is to follow. all the steps ServiceNow is doing to set the value of a given column. It should work