-
Notifications
You must be signed in to change notification settings - Fork 189
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Question: Is any sample code available to refer for parsing yang-patch notification #1657
Comments
There is no specific sample code, YANG data manipulation is performed fully by libyang so I am not sure what exactly are you asking. You are probably not using libnetconf2 so just parse the received notification yourself, using |
Thanks Michal, we are looking for a way to get the patch in xml to provide to consuming applications, so since the data may have multiple edits, we are looking to see if we can extract changes and provide as single xml |
You can do anything you want using libyang parse and print functions. Unless you ask a more specific question, I cannot give you a more precise answer. |
Hi Michal, Thanks for helping, we added a Cell object for this XPath, the resulting notification in yangpatch data had both parent with create , and edits for child as well. For example <ManagedElement xmlns="urn:3gpp:sa5:_3gpp-common-managed-element">
<id>100</id>
<GNBCUCPFunction xmlns="urn:3gpp:sa5:_3gpp-nr-nrm-gnbcucpfunction">
<id>100</id>
<NRCellCU xmlns="urn:3gpp:sa5:_3gpp-nr-nrm-nrcellcu">
<id>10</id>
<attributes>
<cellLocalId>1010</cellLocalId>
<pLMNInfoList>
<mcc>289</mcc>
<mnc>101</mnc>
<sd>ff:ff:ff</sd>
<sst>57</sst>
</pLMNInfoList>
</attributes>
<NRCellCUConfig xmlns="urn:3gpp:sa5:_ran-nr-nrm-nrcellcu">
<PDCPConfigRef>1</PDCPConfigRef>
</NRCellCUConfig>
<NRCellRelation xmlns="urn:3gpp:sa5:_3gpp-nr-nrm-nrcellrelation">
<id>1</id>
<attributes>
<nRTCI>10</nRTCI>
<cellIndividualOffset>
<rsrpOffsetSsb>0</rsrpOffsetSsb>
<rsrqOffsetSsb>0</rsrqOffsetSsb>
<sinrOffsetSsb>0</sinrOffsetSsb>
<rsrpOffsetCsiRs>0</rsrpOffsetCsiRs>
<rsrqOffsetCsiRs>0</rsrqOffsetCsiRs>
<sinrOffsetCsiRs>0</sinrOffsetCsiRs>
</cellIndividualOffset>
</attributes>
</NRCellRelation>
</NRCellCU>
</GNBCUCPFunction>
</ManagedElement> When this block is added, we have about 53 edits, having both parent and child (repeated ) in yang patch, <yang-patch xmlns="urn:ietf:params:xml:ns:yang:ietf-yang-push">
<patch-id>patch-1</patch-id>
<edit>
<edit-id>edit-1</edit-id>
<operation>create</operation>
<target>/_3gpp-common-managed-element:ManagedElement[id='100']/_3gpp-nr-nrm-gnbcucpfunction:GNBCUCPFunction[id='100']/_3gpp-nr-nrm-nrcellcu:NRCellCU[id='10']</target>
<value>
<NRCellCU xmlns="urn:3gpp:sa5:_3gpp-nr-nrm-nrcellcu">
<id>10</id>
<attributes>
<cellLocalId>1010</cellLocalId>
<pLMNInfoList>
<mcc>289</mcc>
<mnc>101</mnc>
<sd>ff:ff:ff</sd>
<sst>57</sst>
</pLMNInfoList>
</attributes>
<NRCellRelation xmlns="urn:3gpp:sa5:_3gpp-nr-nrm-nrcellrelation">
<id>1</id>
<attributes>
<nRTCI>10</nRTCI>
<cellIndividualOffset>
<rsrpOffsetSsb>0</rsrpOffsetSsb>
<rsrqOffsetSsb>0</rsrqOffsetSsb>
<sinrOffsetSsb>0</sinrOffsetSsb>
<rsrpOffsetCsiRs>0</rsrpOffsetCsiRs>
<rsrqOffsetCsiRs>0</rsrqOffsetCsiRs>
<sinrOffsetCsiRs>0</sinrOffsetCsiRs>
</cellIndividualOffset>
<NRCellCUConfig xmlns="urn:3gpp:sa5:_ran-nr-nrm-nrcellcu">
<PDCPConfigRef>1</PDCPConfigRef>
</NRCellCUConfig>
</NRCellCU>
</value>
</edit>
<edit>
<edit-id>edit-2</edit-id>
<operation>create</operation>
<target>/_3gpp-common-managed-element:ManagedElement[id='100']/_3gpp-nr-nrm-gnbcucpfunction:GNBCUCPFunction[id='100']/_3gpp-nr-nrm-nrcellcu:NRCellCU[id='10']/id</target>
<value>
<id xmlns="urn:3gpp:sa5:_3gpp-nr-nrm-nrcellcu">10</id>
</value>
</edit>
<edit>
<edit-id>edit-3</edit-id>
<operation>create</operation>
<target>/_3gpp-common-managed-element:ManagedElement[id='100']/_3gpp-nr-nrm-gnbcucpfunction:GNBCUCPFunction[id='100']/_3gpp-nr-nrm-nrcellcu:NRCellCU[id='10']/attributes</target>
<value>
<attributes xmlns="urn:3gpp:sa5:_3gpp-nr-nrm-nrcellcu">
<cellLocalId>1010</cellLocalId>
<pLMNInfoList>
<mcc>289</mcc>
<mnc>101</mnc>
<sd>ff:ff:ff</sd>
<sst>57</sst>
</pLMNInfoList>
</attributes>
</value>
</edit>
<edit>
<edit-id>edit-4</edit-id>
<operation>create</operation>
<target>/_3gpp-common-managed-element:ManagedElement[id='100']/_3gpp-nr-nrm-gnbcucpfunction:GNBCUCPFunction[id='100']/_3gpp-nr-nrm-nrcellcu:NRCellCU[id='10']/attributes/cellLocalId</target>
<value>
<cellLocalId xmlns="urn:3gpp:sa5:_3gpp-nr-nrm-nrcellcu">1010</cellLocalId>
</value>
</edit> So we wanted to know what is the best mechanism to obtain this patch information without multiple edit for same objects, Thanks, |
Actually, these nested changes should probably not be reported so I have modified sysrepo this way. Unfortunately, |
Thank you Michal |
Hi Michal,
We are trying to use establish push on change notification. We are receiving yang patch notification properly on our application, we want to refer sample code to understand this yang patch parsing.
Thanks,
Srikanth
The text was updated successfully, but these errors were encountered: