- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-19-2024 10:37 PM
Hi Team,
I am trying to achieve physical connection naming convention.
Naming format would be : A-end equipmentname/slot/card/port-Z-end equipmentname/slot/card/port-Linktype
Naming convention rule has to be implemented when user creates an instance using change model/change request (Create physical connection)
Question here, at A-end interface and Z end interface we can only select port but will not come to know to which card and slot the selected port is associated. How to resolve this.
please help with logic and implementation.
Thanks
Vinay
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-23-2024 02:57 PM
Hi @Vinay2509 ,
I dont think you need business rule. You can achieve this in below ways:
1) Update the sn_ni_core.TNIDefaultCINameUtils script or
2) Update/create extension points for sn_ni_core.TNIDefaultCINameUtils.
Option 2 is the best practice.
Here is how you can do that.
(these steps are provided assuming you dont have any customization on this script and you are using the OOB version of the script)
- search for Extension points in navigator. click on Scripted Extension Points
search for sn_ni_core.TNIDefaultCINameUtils
Open this record and update the code: here is the changes I have made to achieve what you wanted.
attaching the complete file for your reference.
Once the code is added, save the code and "create implementation"
Once that is done, you are good to test your changes.
Here is what mine looks like:
Let me know if this was helpful. Please mark this as resolved or let me know if any further help needed.
Thanks,
Aneesh D
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-26-2024 03:55 PM
Hi @Vinay2509 ,
Port ->Card
Car->Slot
relationship will be maintained in CMDB_REL_CI (not just these two, all related CI's in general).
ie: Port(child) -> is related to Card(parent) with Type contains::contained by.
similarly
Car(child) -> Slot(parent).
So you can write a function in the extension code to retrieve the parent details and use their names to generate the Physical connection name.
Here is a sample script for your reference. (You will need to make appropriate changes and include in the extension file)
/*
* Method to get the parent CI record from the CI relatioship
*use port ci sys id to get the card ci sys id
*use card ci sys id to get the slot ci sys id
* @method getParentCi
* @param {childCi} childCI sys id. eg: port_a
*
*/
function getParentCi(childCi) {
var _parentCi = "";
var _parentCiGr = new GlideRecordSecure('cmdb_rel_ci');
_parentCiGr.addQuery("child",childCi);
_parentCiGr.query();
while (_parentCiGr.next()) {
_parentCi = _parentCiGr.parent.getRefRecord();
}
return _parentCi;
}
// calling this function by passing port_a to get the Card C
var _aEndCardCi = getParentCi(ciGr.port_a);
gs.info("A END Card Name: {0}",_aEndCardCi.name);
the same function can be used to get the Slot details by passing card sys id.
Hope this is helpful.
Thanks,
Aneesh D