MultiRadio_all/ParsersReparent2_0.vb
2024-09-26 12:36:15 +00:00

1388 lines
68 KiB
VB.net

Imports System.Xml
Imports System.Xml.XmlDocument
Imports System.Text.RegularExpressions
Module Parsers
Dim reader As XmlTextReader = Nothing
'Public reader2 As XmlTextReader = Nothing
Public bscSwapXmlWriterSites As XmlTextWriter
' Public bscSwapXmlWriterIncAdce As XmlTextWriter
' Public bscSwapXmlWriterOutAdce As XmlTextWriter
' Public bscSwapXmlWriterLapd As XmlTextWriter
' Public bscSwapXmlWriterAdjw As XmlTextWriter
'Public bscSwapXmlWriterAdjg As XmlTextWriter
Dim cnt As Integer = 0 ' element count
Dim newAttr As XmlNode ' operation attribute
Dim newAttrAmhLower As XmlNode ' operation attribute
Dim newAttrAmhUpper As XmlNode ' operation attribute
Dim newAttrAmhMax As XmlNode ' operation attribute
Dim newAttrAmhTrho As XmlNode ' operation attribute
Dim amhllThreshold As XmlNode
Dim amhulThreshold As XmlNode
Dim amhmaxlThreshold As XmlNode
Dim trhoGt As XmlNode
Dim myXmlDocument As XmlDocument
Public Sub removeNodeBcf(ByVal node As XmlNode)
If node.HasChildNodes = True Then
Dim kid As Object
For Each kid In node.ChildNodes
'lb.Items.Add(CType(kid, XmlNode).Name)
If CType(kid, XmlNode).Name = "p" Then
Dim map As XmlNamedNodeMap = kid.Attributes
Dim attrnode As Object
For Each attrnode In map
'fatal
If CType(attrnode, XmlNode).Value = "flexiEdgeAbisOverIpEthernetUsage" Then
node.RemoveChild(kid)
removeNodeBcf(node)
End If
If CType(attrnode, XmlNode).Value = "flexiEdgeAdditional2E1T1Usage" Then
node.RemoveChild(kid)
removeNodeBcf(node)
End If
If CType(attrnode, XmlNode).Value = "flexiEdgeTrsAbisGroomingUsage" Then
node.RemoveChild(kid)
removeNodeBcf(node)
End If
If CType(attrnode, XmlNode).Value = "flexiEdgeTrsLoopProtectionUsage" Then
node.RemoveChild(kid)
removeNodeBcf(node)
End If
If CType(attrnode, XmlNode).Value = "syncSource" Then
node.RemoveChild(kid)
removeNodeBcf(node)
End If
Next attrnode
End If
Next kid
End If
End Sub
Public Sub removeNodeBts(ByVal node As XmlNode)
If node.HasChildNodes = True Then
Dim kid As Object
For Each kid In node.ChildNodes
'lb.Items.Add(CType(kid, XmlNode).Name)
If CType(kid, XmlNode).Name = "list" Then
Dim map As XmlNamedNodeMap = kid.Attributes
Dim attrnode As Object
For Each attrnode In map
If CType(attrnode, XmlNode).Value = "trafficTypesForTrunk" Then
node.RemoveChild(kid)
removeNodeBts(node)
End If
Next
End If
If CType(kid, XmlNode).Name = "p" Then
Dim map As XmlNamedNodeMap = kid.Attributes
Dim attrnode As Object
For Each attrnode In map
'fatal
If CType(attrnode, XmlNode).Value = "antennaHopping" Then
node.RemoveChild(kid)
removeNodeBts(node)
End If
If CType(attrnode, XmlNode).Value = "freeTchLimit" Then
node.RemoveChild(kid)
removeNodeBts(node)
End If
If CType(attrnode, XmlNode).Value = "idrCellType" Then
node.RemoveChild(kid)
removeNodeBts(node)
End If
If CType(attrnode, XmlNode).Value = "idrUsed" Then
node.RemoveChild(kid)
removeNodeBts(node)
End If
If CType(attrnode, XmlNode).Value = "nbrTchForPrioritySubs" Then
node.RemoveChild(kid)
removeNodeBts(node)
End If
If CType(attrnode, XmlNode).Value = "maioStep" Then
node.RemoveChild(kid)
removeNodeBts(node)
End If
If CType(attrnode, XmlNode).Value = "priorityChUseIncomingHO" Then
node.RemoveChild(kid)
removeNodeBts(node)
End If
If CType(attrnode, XmlNode).Value = "reservationMethod" Then
node.RemoveChild(kid)
removeNodeBts(node)
End If
If CType(attrnode, XmlNode).Value = "trafficTypesForTrunk" Then
node.RemoveChild(kid)
removeNodeBts(node)
End If
If CType(attrnode, XmlNode).Value = "trunkReservationUsed" Then
node.RemoveChild(kid)
removeNodeBts(node)
End If
If CType(attrnode, XmlNode).Value = "radiusExtension" Then
node.RemoveChild(kid)
removeNodeBts(node)
End If
' error parameters
If CType(attrnode, XmlNode).Value = "idleStateBcchAllocIdUsed" Then
node.RemoveChild(kid)
removeNodeBts(node)
End If
If CType(attrnode, XmlNode).Value = "usedMobileAllocIdUsed" Then
node.RemoveChild(kid)
removeNodeBts(node)
End If
If CType(attrnode, XmlNode).Value = "underlayMaIdUsed" Then
node.RemoveChild(kid)
removeNodeBts(node)
End If
'segmentName
If CType(attrnode, XmlNode).Value = "segmentName" Then
node.RemoveChild(kid)
removeNodeBts(node)
End If
Next attrnode
End If
Next kid
End If
End Sub
Public Sub removeNodeHoc(ByVal node As XmlNode)
If node.HasChildNodes = True Then
Dim kid As Object
For Each kid In node.ChildNodes
'lb.Items.Add(CType(kid, XmlNode).Name)
If CType(kid, XmlNode).Name = "p" Then
Dim map As XmlNamedNodeMap = kid.Attributes
Dim attrnode As Object
For Each attrnode In map
'fatal
If CType(attrnode, XmlNode).Value = "ciEstMethod" Then
node.RemoveChild(kid)
removeNodeHoc(node)
End If
If CType(attrnode, XmlNode).Value = "invalidBsicReporting" Then
node.RemoveChild(kid)
removeNodeHoc(node)
End If
If CType(attrnode, XmlNode).Value = "lowerCiLimit" Then
node.RemoveChild(kid)
removeNodeHoc(node)
End If
If CType(attrnode, XmlNode).Value = "priorityAdjStep" Then
node.RemoveChild(kid)
removeNodeHoc(node)
End If
If CType(attrnode, XmlNode).Value = "reportingRate" Then
node.RemoveChild(kid)
removeNodeHoc(node)
End If
'error
If CType(attrnode, XmlNode).Value = "enableIntracellHandover" Then
node.RemoveChild(kid)
removeNodeHoc(node)
End If
Next attrnode
End If
Next kid
End If
End Sub
Public Sub removeNodePoc(ByVal node As XmlNode)
If node.HasChildNodes = True Then
Dim kid As Object
For Each kid In node.ChildNodes
'lb.Items.Add(CType(kid, XmlNode).Name)
If CType(kid, XmlNode).Name = "p" Then
Dim map As XmlNamedNodeMap = kid.Attributes
Dim attrnode As Object
'fatal
For Each attrnode In map
If CType(attrnode, XmlNode).Value = "bsTxPwrOffset" Then
node.RemoveChild(kid)
removeNodePoc(node)
End If
Next attrnode
End If
Next kid
End If
End Sub
Public Sub getNodes(ByVal afile As String, ByVal lb As ListBox, ByVal sb As StatusBar)
Try
reader = New XmlTextReader(afile)
' Create an XmlDocument from the XmlTextReader
myXmlDocument = New XmlDocument
Dim namespaceManager As New XmlNamespaceManager(myXmlDocument.NameTable)
namespaceManager.AddNamespace("ns", "raml20.dtd")
sb.Text = "Loading XML document...."
myXmlDocument.Load(reader)
lb.Items.Add("XmlDocument loaded successfully ...")
sb.Text = "XML document loaded successfully"
' Process the supplied XML file
lb.Items.Add("Processing ...")
sb.Text = "Processing ..."
' operation attribute
newAttr = myXmlDocument.CreateAttribute("operation")
newAttr.Value = "create"
' amhllThreshold.Attributes.SetNamedItem(newAttr1)
'amhllThreshold.InnerText = "N"
' Start from the document Element
DisplayTree(myXmlDocument.DocumentElement, lb, sb)
Catch e As Exception
Console.WriteLine("Exception:" & e.ToString())
Finally
If Not reader Is Nothing Then
reader.Close()
'lb.Items.Add("")
' Process the supplied XML file
lb.Items.Add("Document read finished")
lb.Items.Add("")
End If
End Try
sb.Text = "Reader closed"
newAttrAmhLower = myXmlDocument.CreateAttribute("name")
newAttrAmhLower.Value = "amhLowerLoadThreshold"
newAttrAmhUpper = myXmlDocument.CreateAttribute("name")
newAttrAmhUpper.Value = "amhUpperLoadThreshold"
newAttrAmhMax = myXmlDocument.CreateAttribute("name")
newAttrAmhMax.Value = "amhMaxLoadOfTgtCell"
newAttrAmhTrho = myXmlDocument.CreateAttribute("name")
newAttrAmhTrho.Value = "amhTrhoGuardTime"
amhllThreshold = myXmlDocument.CreateElement("p")
amhllThreshold.Attributes.Append(newAttrAmhLower)
amhulThreshold = myXmlDocument.CreateElement("p")
amhulThreshold.Attributes.Append(newAttrAmhUpper)
amhmaxlThreshold = myXmlDocument.CreateElement("p")
amhmaxlThreshold.Attributes.Append(newAttrAmhMax)
trhoGt = myXmlDocument.CreateElement("p")
trhoGt.Attributes.Append(newAttrAmhTrho)
End Sub
Public Sub DisplayTree(ByVal node As XmlNode, ByVal lb As ListBox, ByVal sb As StatusBar)
If Not IsNothing(node) Then
FormatAll(node, lb, sb)
End If
If node.HasChildNodes Then
node = node.FirstChild
While Not IsNothing(node)
DisplayTree(node, lb, sb)
node = node.NextSibling
End While
End If
End Sub
Private Sub FormatAll(ByVal node As XmlNode, ByVal lb As ListBox, ByVal sb As StatusBar)
Dim modCNum As String = "BSC-" & newCNum
Dim oldCNumStr As String = "BSC-" & oldCNum
Dim blnMatchBts As Boolean
' Dim blnMatchAdce As Boolean
Dim blnMatchBcf As Boolean
Dim blnMatchLapd As Boolean
Dim blnMatchHoc As Boolean
Dim blnMatchPoc As Boolean
Dim blnMatchAdjl As Boolean
Dim blnMatchTrx As Boolean
' Dim blnMatchAdjg As Boolean
' Dim blnMatchAdjw As Boolean
' Dim MatchAdjg As String = "ADJG"
' Dim MatchAdjw As String = "ADJW"
Dim MatchBts As String = "BTS"
Dim MatchBcf As String = "BCF"
Dim MatchTrx As String = "TRX"
Dim MatchHoc As String = "HOC"
Dim MatchPoc As String = "POC"
Dim MatchAdjl As String = "ADJL"
Dim MatchLapd As String = "LAPD"
' Dim MatchAdce As String = "ADCE"
If XmlNodeType.Element = node.NodeType Then
If node.Name = "managedObject" Then
'remove the id attribute
node.Attributes.RemoveNamedItem("id")
' ad the operation attribute
node.Attributes.SetNamedItem(newAttr)
End If
Dim map As XmlNamedNodeMap = node.Attributes
Dim attrnode As XmlAttribute
For Each attrnode In map
If CType(attrnode, XmlNode).Name = "class" Then
' node.Attributes.GetNamedItem("id").Value = Regex.Replace( _
' node.Attributes.GetNamedItem("id").Value, node.Attributes.GetNamedItem( _
' "id").Value, "create")
' blnMatchAdjw = Regex.IsMatch(CType(attrnode, XmlNode).Value, MatchAdjw)
' blnMatchAdjg = Regex.IsMatch(CType(attrnode, XmlNode).Value, MatchAdjg)
blnMatchBcf = Regex.IsMatch(CType(attrnode, XmlNode).Value, MatchBcf)
blnMatchBts = Regex.IsMatch(CType(attrnode, XmlNode).Value, MatchBts)
blnMatchTrx = Regex.IsMatch(CType(attrnode, XmlNode).Value, MatchTrx)
blnMatchHoc = Regex.IsMatch(CType(attrnode, XmlNode).Value, MatchHoc)
blnMatchPoc = Regex.IsMatch(CType(attrnode, XmlNode).Value, MatchPoc)
blnMatchAdjl = Regex.IsMatch(CType(attrnode, XmlNode).Value, MatchAdjl)
blnMatchLapd = Regex.IsMatch(CType(attrnode, XmlNode).Value, MatchLapd)
' blnMatchAdce = Regex.IsMatch(CType(attrnode, XmlNode).Value, MatchAdce)
If blnMatchBcf = True Then
' removeId(node)
changeCNum(node)
removeLapdLinkNum(node) 'remove lapdlinknumber
changeLapdLinkNameInBcf(node, lb, sb)
removeNodeBcf(node)
updateAddressNode(node)
changeAdminState(node)
If Reparent.CheckBox1.Checked Then
changeETPinBCF(node) ' SF 21/08/2024 see below for full function. Fully working.
AddLogicalBcxuAddressElement(node) ' SF 21/08/2024 see below for full function! Fully working.
AddPrimaryBCF(node) ' SF 26/09/24 added this but why did I not earlier?
End If
bcfCol.Add(node)
bcfCnt = bcfCnt + 1
'getLac(node, myCell)
End If
If blnMatchBts = True Then
'removeId(node)
changeRac(node)
changeSeg(node)
changeCNum(node)
changeLac(node, lb, sb) ' and remove gprs
removeNodeBts(node)
updateAddressNode(node)
changeCellBroadcast(node)
changeMalId(node)
If Reparent.CheckBox1.Checked Then
AddPrimaryBCF(node) ' SF 21/08/2024 see below for full function! Fully working.
End If
'insertAmhParas(node)
btsCol.Add(node)
btsCnt = btsCnt + 1
End If
If blnMatchTrx = True Then
'removeId(node)
changeCNum(node)
changePcmInTrx(node)
removeLapdLinkNum(node) ' remove lapdlinknumber
changeLapdLinkNameInTrx(node)
updateAddressNode(node)
modifySDCCB(node)
trxCol.Add(node)
trxCnt = trxCnt + 1
End If
If blnMatchHoc = True Then
'removeId(node)
changeCNum(node)
removeNodeHoc(node)
updateAddressNode(node)
hocCol.Add(node)
hocCnt = hocCnt + 1
End If
If blnMatchPoc = True Then
changeCNum(node)
removeNodePoc(node)
updateAddressNode(node)
pocCol.Add(node)
pocCnt = pocCnt + 1
End If
If blnMatchAdjl = True Then
changeCNum(node)
adjlCol.Add(node)
adjlCnt = adjlCnt + 1
End If
' If blnMatchAdce = True Then
' checkDirection(node)
' adceCnt = adceCnt + 1
' End If
' If blnMatchAdjw = True Then
'changeCNumAdjwMerge(node, lb, sb) ' this is the merge version which changes BCF/BTS as well!
'adjwCol.Add(node)
' adjwCnt = adjwCnt + 1
'End If
' If blnMatchAdjg = True Then
' changeTargetCellDnAdjg(node, lb, sb)
' changeTargetCellDnAdjgBcf(node, lb, sb)
' changeTargetCellDnAdjgBts(node, lb, sb)
'changeLacAdjg(node, lb, sb)
'adjgCol.Add(node)
' adjgCnt = adjgCnt + 1
' End If
End If
Next attrnode
End If ' XmlNodeType.Element = node.NodeType
End Sub
Public Sub insertAmhParas(ByVal node As XmlNode)
'node.AppendChild(amhllThreshold)
' node.AppendChild(amhulThreshold)
'node.AppendChild(amhmaxlThreshold)
' node.AppendChild(trhoGt)
End Sub
Public Sub checkDirection(ByVal node As XmlNode)
Dim oldCNumStr As String = "BSC-" & oldCNum
Dim blnMatchCNum As Boolean = False
If XmlNodeType.Element = node.NodeType Then
'If CType(node, XmlNode).Name = "managedObject" Then
Dim map As XmlNamedNodeMap = node.Attributes
Dim attrnode As Object
For Each attrnode In map
If CType(attrnode, XmlNode).Name = "distName" Then
blnMatchCNum = Regex.IsMatch(CType(attrnode, XmlNode).Value, oldCNumStr)
If blnMatchCNum = True Then
'this is outgoing
changeTargetCellDnAdjg(node)
changeTargetCellDnAdjgBcf(node)
changeTargetCellDnAdjgBts(node)
changeCNum(node)
' changeCNumAdce(node)
'removeTargetCellDN(node)
outAdceCol.Add(node)
outAdceCnt = outAdceCnt + 1
ElseIf blnMatchCNum = False Then
'This is incomig
changeTargetCellDnAdjg(node)
changeTargetCellDnAdjgBcf(node)
changeTargetCellDnAdjgBts(node)
changeCNum(node)
changeCNumIncAdce(node)
' removeTargetCellDN(node)
incAdceCol.Add(node)
incAdceCnt = incAdceCnt + 1
End If
End If
Next attrnode
'End If
End If
End Sub
Public Sub changeTargetCellDnAdjg(ByVal node As XmlNode)
'cnum
Dim blnMatchCNum As Boolean
Dim modCNum As String = "BSC-" & newCNum
Dim oldCNumStr As String = "BSC-" & oldCNum
If node.HasChildNodes = True Then
Dim kid As Object
For Each kid In node.ChildNodes
'lb.Items.Add(CType(kid, XmlNode).Name)
If CType(kid, XmlNode).Name = "p" Then
Dim map As XmlNamedNodeMap = kid.Attributes
Dim attrnode As Object
Dim found As Boolean
For Each attrnode In map
If CType(attrnode, XmlNode).Value = "targetCellDN" Then
blnMatchCNum = Regex.IsMatch(CType(kid, XmlNode).InnerText, oldCNumStr)
If blnMatchCNum = True Then
CType(kid, XmlNode).InnerText = Regex.Replace(CType(kid, XmlNode).InnerText, _
oldCNumStr, modCNum)
End If
End If
Next attrnode
End If
Next kid
End If
End Sub
Public Sub changeTargetCellDnAdjgBcf(ByVal node As XmlNode)
'bcf
Dim blnMatchCNumOld As Boolean
Dim blnMatchCNumNew As Boolean
Dim modCNum As String = "BSC-" & newCNum
Dim oldCNumStr As String = "BSC-" & oldCNum
If node.HasChildNodes = True Then
Dim kid As Object
For Each kid In node.ChildNodes
'lb.Items.Add(CType(kid, XmlNode).Name)
If CType(kid, XmlNode).Name = "p" Then
Dim map As XmlNamedNodeMap = kid.Attributes
Dim attrnode As Object
Dim found As Boolean
For Each attrnode In map
If CType(attrnode, XmlNode).Value = "targetCellDN" Then
blnMatchCNumOld = Regex.IsMatch(CType(kid, XmlNode).InnerText, oldCNumStr)
blnMatchCNumNew = Regex.IsMatch(CType(kid, XmlNode).InnerText, modCNum)
If blnMatchCNumOld = True OrElse blnMatchCNumNew = True Then
Dim bf As Bcf
For Each bf In chgBcfCol
Dim bcfId As Match
Dim newBcfId As String = "BCF-" & bf.newIndex
bcfId = Regex.Match(CType(kid, XmlNode).InnerText, "BCF-[0-9]{1,4}")
If bcfId.Value.Equals("BCF-" & bf.oldIndex) Then
CType(kid, XmlNode).InnerText = Regex.Replace(CType(kid, XmlNode).InnerText, bcfId.Value, newBcfId)
End If
Next bf
End If
End If
Next attrnode
End If
Next kid
End If
End Sub
Public Sub changeTargetCellDnAdjgBts(ByVal node As XmlNode)
'bts
Dim blnMatchCNumOld As Boolean
Dim blnMatchCNumNew As Boolean
Dim modCNum As String = "BSC-" & newCNum
Dim oldCNumStr As String = "BSC-" & oldCNum
If node.HasChildNodes = True Then
Dim kid As Object
For Each kid In node.ChildNodes
'lb.Items.Add(CType(kid, XmlNode).Name)
If CType(kid, XmlNode).Name = "p" Then
Dim map As XmlNamedNodeMap = kid.Attributes
Dim attrnode As Object
Dim found As Boolean
For Each attrnode In map
If CType(attrnode, XmlNode).Value = "targetCellDN" Then
blnMatchCNumOld = Regex.IsMatch(CType(kid, XmlNode).InnerText, oldCNumStr)
blnMatchCNumNew = Regex.IsMatch(CType(kid, XmlNode).InnerText, modCNum)
If blnMatchCNumOld = True OrElse blnMatchCNumNew = True Then
Dim bt As Bts
For Each bt In chgBtsCol
Dim btsId As Match
Dim newBtsId As String = "BTS-" & bt.newIndex
btsId = Regex.Match(CType(kid, XmlNode).InnerText, "BTS-[0-9]{1,4}")
If btsId.Value.Equals("BTS-" & bt.oldIndex) Then
CType(kid, XmlNode).InnerText = Regex.Replace(CType(kid, XmlNode).InnerText, btsId.Value, newBtsId)
End If
Next bt
End If
End If
Next attrnode
End If
Next kid
End If
End Sub
Public Sub changeCNumAdjwMerge(ByVal node As XmlNode, ByVal lb As ListBox, ByVal sb As StatusBar)
'Sw version changed to S11.5
' for bsc merge, need to change BCF & BTS IDs as well as CNum if Cnum matches.
Dim modCNum As String = "BSC-" & newCNum
Dim oldCNumStr As String = "BSC-" & oldCNum
Dim blnMatchCNum As Boolean
If XmlNodeType.Element = node.NodeType Then
'If CType(node, XmlNode).Name = "managedObject" Then
Dim map As XmlNamedNodeMap = node.Attributes
Dim attrnode As Object
For Each attrnode In map
If CType(attrnode, XmlNode).Name = "distName" Then
blnMatchCNum = Regex.IsMatch(CType(attrnode, XmlNode).Value, oldCNumStr)
If blnMatchCNum = True Then 'if matches old cnumber
Dim bf As Bcf
For Each bf In chgBcfCol
Dim bcfId As Match
Dim newBcfId As String = "BCF-" & bf.newIndex
bcfId = Regex.Match(CType(attrnode, XmlNode).Value, "/BCF-[0-9]{1,4}")
If bcfId.Value.Equals("BCF-" & bf.oldIndex) Then
CType(attrnode, XmlNode).Value = Regex.Replace(CType(attrnode, XmlNode).Value, bcfId.Value, newBcfId)
End If
Next bf
Dim bt As Bts
For Each bt In chgBtsCol
Dim btsId As Match
Dim newBtsId As String = "/BTS-" & bt.newIndex
btsId = Regex.Match(CType(attrnode, XmlNode).Value, "/BTS-[0-9]{1,4}")
If btsId.Value.Equals("BTS-" & bt.oldIndex) Then
CType(attrnode, XmlNode).Value = Regex.Replace(CType(attrnode, XmlNode).Value, btsId.Value, newBtsId)
End If
Next bt
End If
'blnMatchBcfInDn = Regex.IsMatch(CType(attrnode, XmlNode).Value, MatchBcfInDn)
'Change old cnumber to new
CType(attrnode, XmlNode).Value = Regex.Replace(CType(attrnode, XmlNode).Value, _
oldCNumStr, modCNum)
End If
If CType(attrnode, XmlNode).Name = "version" Then
CType(attrnode, XmlNode).Value = Regex.Replace(CType(attrnode, XmlNode).Value, _
CType(attrnode, XmlNode).Value, SwVersion)
End If
' If CType(attrnode, XmlNode).Name = "id" Then
' node.Attributes.Remove(attrnode)
'End If
Next attrnode
'End If
End If
End Sub
Public Sub removeLapdLinkNum(ByVal node As XmlNode)
If node.HasChildNodes = True Then
Dim kid As Object
For Each kid In node.ChildNodes
'lb.Items.Add(CType(kid, XmlNode).Name)
If CType(kid, XmlNode).Name = "p" Then
Dim map As XmlNamedNodeMap = kid.Attributes
Dim attrnode As Object
For Each attrnode In map
If CType(attrnode, XmlNode).Value = "lapdLinkNumber" Then
node.RemoveChild(kid)
End If
Next attrnode
End If
Next kid
End If
End Sub
Public Sub changeLac(ByVal node As XmlNode, ByVal lb As ListBox, ByVal sb As StatusBar)
' find lac element..
'gprsEnabled change to zero
'<p name="nsei">6251</p> remove element
'<p name="rac">85</p> 255
If node.HasChildNodes = True Then
Dim kid As Object
For Each kid In node.ChildNodes
'lb.Items.Add(CType(kid, XmlNode).Name)
If CType(kid, XmlNode).Name = "p" Then
Dim map As XmlNamedNodeMap = kid.Attributes
Dim attrnode As Object
For Each attrnode In map
If CType(attrnode, XmlNode).Value = "locationAreaIdLAC" Then
'MsgBox("match lac node!")
If CType(kid, XmlNode).InnerText = oldO2Lac Then
CType(kid, XmlNode).InnerText = newO2Lac
ElseIf CType(kid, XmlNode).InnerText = oldVfLac Then
CType(kid, XmlNode).InnerText = newVfLac
End If
End If
' If CType(attrnode, XmlNode).Value = "gprsEnabled" Then
'MsgBox("match gena node!")
'CType(kid, XmlNode).InnerText = "0"
' End If
' If CType(attrnode, XmlNode).Value = "rac" Then
'MsgBox("match rac node!")
'CType(kid, XmlNode).InnerText = newO2RacVal
' End If
If CType(attrnode, XmlNode).Value = "nsei" Then
'MsgBox("match nsei node!")
node.RemoveChild(kid)
End If
Next attrnode
End If
Next kid
End If
End Sub
Public Sub changeRac(ByVal node As XmlNode)
' find lac element..
'gprsEnabled change to zero
'<p name="nsei">6251</p> remove element
'<p name="rac">85</p> 255
If node.HasChildNodes = True Then
Dim kid As Object
For Each kid In node.ChildNodes
'lb.Items.Add(CType(kid, XmlNode).Name)
If CType(kid, XmlNode).Name = "p" Then
Dim map As XmlNamedNodeMap = kid.Attributes
Dim attrnode As Object
For Each attrnode In map
If CType(attrnode, XmlNode).Value = "rac" Then
'MsgBox("match rac node!")
If CType(kid, XmlNode).InnerText = oldO2Rac Then
CType(kid, XmlNode).InnerText = newO2Rac
ElseIf CType(kid, XmlNode).InnerText = oldVfRac Then
CType(kid, XmlNode).InnerText = newVfRac
End If
End If
Next attrnode
End If
Next kid
End If
End Sub
Public Sub changeSeg(ByVal node As XmlNode)
If node.HasChildNodes = True Then
Dim kid As Object
For Each kid In node.ChildNodes
'lb.Items.Add(CType(kid, XmlNode).Name)
If CType(kid, XmlNode).Name = "p" Then
Dim map As XmlNamedNodeMap = kid.Attributes
Dim attrnode As Object
For Each attrnode In map
If CType(attrnode, XmlNode).Value = "segmentId" Then
'MsgBox("match segmentId node!")
Dim s As Bts
Dim segId As Match
segId = Regex.Match(CType(kid, XmlNode).InnerText, "[0-9]{1,4}")
For Each s In chgBtsCol
Dim newSegId As String = s.newSeg
If segId.Value.Equals(s.oldSeg) Then
'CType(kid, XmlNode).InnerText = Regex.Replace(CType(kid, XmlNode).InnerText, segId.Value, newSegId)
CType(kid, XmlNode).InnerText = s.newSeg
Exit Sub
End If
Next s
End If
Next attrnode
End If
Next kid
End If
End Sub
Public Sub updateAddressNode(ByVal node As XmlNode)
If node.HasChildNodes = True Then
Dim kid As Object
For Each kid In node.ChildNodes
'lb.Items.Add(CType(kid, XmlNode).Name)
If CType(kid, XmlNode).Name = "p" Then
Dim map As XmlNamedNodeMap = kid.Attributes
Dim attrnode As Object
For Each attrnode In map
If CType(attrnode, XmlNode).Value = "address" Then
'MsgBox("match segmentId node!")
If CType(kid, XmlNode).InnerText = oldBscName Then
CType(kid, XmlNode).InnerText = newBscName
End If
End If
Next attrnode
End If
Next kid
End If
End Sub
Public Sub changeAdminState(ByVal node As XmlNode)
If node.HasChildNodes = True Then
Dim kid As Object
For Each kid In node.ChildNodes
'lb.Items.Add(CType(kid, XmlNode).Name)
If CType(kid, XmlNode).Name = "p" Then
Dim map As XmlNamedNodeMap = kid.Attributes
Dim attrnode As Object
For Each attrnode In map
If CType(attrnode, XmlNode).Value = "adminState" Then
'MsgBox("match segmentId node!")
CType(kid, XmlNode).InnerText = "3"
End If
Next attrnode
End If
Next kid
End If
End Sub
Public Sub modifySDCCB(ByVal node As XmlNode)
If node.HasChildNodes = True Then
Dim kid As Object
For Each kid In node.ChildNodes
'lb.Items.Add(CType(kid, XmlNode).Name)
If CType(kid, XmlNode).Name = "p" Then
Dim map As XmlNamedNodeMap = kid.Attributes
Dim attrnode As Object
For Each attrnode In map
If CType(attrnode, XmlNode).Value = "channel0Type" Then
'MsgBox("match segmentId node!")
If CType(kid, XmlNode).InnerText = "8" Then
CType(kid, XmlNode).InnerText = "3"
End If
End If
If CType(attrnode, XmlNode).Value = "channel1Type" Then
'MsgBox("match segmentId node!")
If CType(kid, XmlNode).InnerText = "8" Then
CType(kid, XmlNode).InnerText = "3"
End If
End If
If CType(attrnode, XmlNode).Value = "channel2Type" Then
'MsgBox("match segmentId node!")
If CType(kid, XmlNode).InnerText = "8" Then
CType(kid, XmlNode).InnerText = "3"
End If
End If
If CType(attrnode, XmlNode).Value = "channel3Type" Then
'MsgBox("match segmentId node!")
If CType(kid, XmlNode).InnerText = "8" Then
CType(kid, XmlNode).InnerText = "3"
End If
End If
If CType(attrnode, XmlNode).Value = "channel4Type" Then
'MsgBox("match segmentId node!")
If CType(kid, XmlNode).InnerText = "8" Then
CType(kid, XmlNode).InnerText = "3"
End If
End If
If CType(attrnode, XmlNode).Value = "channel5Type" Then
'MsgBox("match segmentId node!")
If CType(kid, XmlNode).InnerText = "8" Then
CType(kid, XmlNode).InnerText = "3"
End If
End If
If CType(attrnode, XmlNode).Value = "channel6Type" Then
'MsgBox("match segmentId node!")
If CType(kid, XmlNode).InnerText = "8" Then
CType(kid, XmlNode).InnerText = "3"
End If
End If
If CType(attrnode, XmlNode).Value = "channel7Type" Then
'MsgBox("match segmentId node!")
If CType(kid, XmlNode).InnerText = "8" Then
CType(kid, XmlNode).InnerText = "3"
End If
End If
Next attrnode
End If
Next kid
End If
End Sub
Public Sub changeMalId(ByVal node As XmlNode)
'get BTS ID for MAL ID modification
Dim btsid As String = ""
If XmlNodeType.Element = node.NodeType Then
'If CType(node, XmlNode).Name = "managedObject" Then
Dim map As XmlNamedNodeMap = node.Attributes
Dim attr As Object
For Each attr In map
If CType(attr, XmlNode).Name = "distName" Then
Dim btsreg As String = "PLMN-PLMN/BSC-(?<bsc>(\d+))/BCF-\d+/BTS-(?<bts>(\d+))$"
btsid = Regex.Match(CType(attr, XmlNode).Value, btsreg).Groups("bts").ToString
Exit For
End If
Next attr
End If
If node.HasChildNodes = True Then
Dim kid As Object
For Each kid In node.ChildNodes
'lb.Items.Add(CType(kid, XmlNode).Name)
If CType(kid, XmlNode).Name = "p" Then
Dim map As XmlNamedNodeMap = kid.Attributes
Dim attrnode As Object
For Each attrnode In map
If CType(attrnode, XmlNode).Value = "usedMobileAllocation" Then
'MsgBox("match segmentId node!")
Dim mal As String = CType(kid, XmlNode).InnerText
' If mal = "0" OrElse mal = "1" OrElse mal = "2" OrElse mal = "3" OrElse mal = "1001" OrElse mal = "1002" OrElse mal = "1003" Then
'do nothing
'Else
CType(kid, XmlNode).InnerText = btsid
' End If
End If
Next attrnode
End If
Next kid
End If
End Sub
Public Sub changeCellBroadcast(ByVal node As XmlNode)
If node.HasChildNodes = True Then
Dim kid As Object
For Each kid In node.ChildNodes
'lb.Items.Add(CType(kid, XmlNode).Name)
If CType(kid, XmlNode).Name = "p" Then
Dim map As XmlNamedNodeMap = kid.Attributes
Dim attrnode As Object
For Each attrnode In map
If CType(attrnode, XmlNode).Value = "smsCbUsed" Then
'MsgBox("match segmentId node!")
CType(kid, XmlNode).InnerText = "0"
End If
Next attrnode
End If
Next kid
End If
End Sub
Public Sub changeCNum(ByVal node As XmlNode)
'Sw version changed to S11.5
' for bsc merge, need to change BCF & BTS IDs as well as CNum if Cnum matches.
Dim modCNum As String = "BSC-" & newCNum
Dim oldCNumStr As String = "BSC-" & oldCNum
Dim blnMatchCNum As Boolean
If XmlNodeType.Element = node.NodeType Then
'If CType(node, XmlNode).Name = "managedObject" Then
Dim map As XmlNamedNodeMap = node.Attributes
Dim attrnode As Object
For Each attrnode In map
If CType(attrnode, XmlNode).Name = "distName" Then
blnMatchCNum = Regex.IsMatch(CType(attrnode, XmlNode).Value, oldCNumStr)
If blnMatchCNum = True Then
CType(attrnode, XmlNode).Value = Regex.Replace(CType(attrnode, XmlNode).Value, _
oldCNumStr, modCNum)
Dim bcfId As Match
bcfId = Regex.Match(CType(attrnode, XmlNode).Value, "BCF-[0-9]{1,4}")
Dim bf As Bcf
For Each bf In chgBcfCol
Dim newBcfId As String = "BCF-" & bf.newIndex
If bcfId.Value.Equals("BCF-" & bf.oldIndex) Then
CType(attrnode, XmlNode).Value = Regex.Replace(CType(attrnode, XmlNode).Value, bcfId.Value, newBcfId)
Exit For
End If
Next bf
Dim bt As Bts
Dim btsId As Match
btsId = Regex.Match(CType(attrnode, XmlNode).Value, "BTS-[0-9]{1,4}")
For Each bt In chgBtsCol
Dim newBtsId As String = "BTS-" & bt.newIndex
If btsId.Value.Equals("BTS-" & bt.oldIndex) Then
CType(attrnode, XmlNode).Value = Regex.Replace(CType(attrnode, XmlNode).Value, btsId.Value, newBtsId)
Exit For
End If
Next bt
End If
'blnMatchBcfInDn = Regex.IsMatch(CType(attrnode, XmlNode).Value, MatchBcfInDn)
End If
If CType(attrnode, XmlNode).Name = "version" Then
CType(attrnode, XmlNode).Value = Regex.Replace(CType(attrnode, XmlNode).Value, _
CType(attrnode, XmlNode).Value, SwVersion)
End If
' If CType(attrnode, XmlNode).Name = "id" Then
' node.Attributes.Remove(attrnode)
'End If
Next attrnode
'End If
End If
End Sub
Public Sub changeCNumIncAdce(ByVal node As XmlNode)
' changes to new RAC value for incoming ADCE
Dim modCNum As String = "BSC-" & newCNum
Dim oldCNumStr As String = "BSC-" & oldCNum
If node.HasChildNodes = True Then
Dim kid As Object
For Each kid In node.ChildNodes
'lb.Items.Add(CType(kid, XmlNode).Name)
If CType(kid, XmlNode).Name = "p" Then
Dim map As XmlNamedNodeMap = kid.Attributes
Dim attrnode As Object
For Each attrnode In map
' If CType(attrnode, XmlNode).Value = "targetCellDN" Then
'node.RemoveChild(kid)
'End If
If CType(attrnode, XmlNode).Value = "rac" Then 'remove rac
'node.RemoveChild(kid)
' CType(kid, XmlNode).InnerText = Regex.Replace(CType(kid, XmlNode).InnerText, _
' CType(kid, XmlNode).InnerText, newO2RacVal)
CType(kid, XmlNode).InnerText = newO2Rac
End If
Next attrnode
End If
Next kid
End If
End Sub
Public Sub changePcmInTrx(ByVal node As XmlNode)
' ### this version handles both TRX formats ###
If node.HasChildNodes = True Then
Dim kid As Object
For Each kid In node.ChildNodes
If CType(kid, XmlNode).Name = "p" Then
Dim map As XmlNamedNodeMap = kid.Attributes
Dim attrnode As Object
For Each attrnode In map
If CType(attrnode, XmlNode).Value = "channel0Pcm" Then
' CType(kid, XmlNode).InnerText = dummyLac
Dim p As Pcm
For Each p In pcmCol
If CType(kid, XmlNode).InnerText = p.oldIndex Then
CType(kid, XmlNode).InnerText = Regex.Replace(CType(kid, XmlNode).InnerText, _
CType(kid, XmlNode).InnerText, p.newIndex)
Exit For
End If
Next p
End If
If CType(attrnode, XmlNode).Value = "channel1Pcm" Then
' CType(kid, XmlNode).InnerText = dummyLac
Dim p As Pcm
For Each p In pcmCol
If CType(kid, XmlNode).InnerText = p.oldIndex Then
CType(kid, XmlNode).InnerText = Regex.Replace(CType(kid, XmlNode).InnerText, _
CType(kid, XmlNode).InnerText, p.newIndex)
Exit For
End If
Next p
End If
If CType(attrnode, XmlNode).Value = "channel2Pcm" Then
' CType(kid, XmlNode).InnerText = dummyLac
Dim p As Pcm
For Each p In pcmCol
If CType(kid, XmlNode).InnerText = p.oldIndex Then
CType(kid, XmlNode).InnerText = Regex.Replace(CType(kid, XmlNode).InnerText, _
CType(kid, XmlNode).InnerText, p.newIndex)
Exit For
End If
Next p
End If
If CType(attrnode, XmlNode).Value = "channel3Pcm" Then
' CType(kid, XmlNode).InnerText = dummyLac
Dim p As Pcm
For Each p In pcmCol
If CType(kid, XmlNode).InnerText = p.oldIndex Then
CType(kid, XmlNode).InnerText = Regex.Replace(CType(kid, XmlNode).InnerText, _
CType(kid, XmlNode).InnerText, p.newIndex)
Exit For
End If
Next p
End If
If CType(attrnode, XmlNode).Value = "channel4Pcm" Then
' CType(kid, XmlNode).InnerText = dummyLac
Dim p As Pcm
For Each p In pcmCol
If CType(kid, XmlNode).InnerText = p.oldIndex Then
CType(kid, XmlNode).InnerText = Regex.Replace(CType(kid, XmlNode).InnerText, _
CType(kid, XmlNode).InnerText, p.newIndex)
Exit For
End If
Next p
End If
If CType(attrnode, XmlNode).Value = "channel5Pcm" Then
' CType(kid, XmlNode).InnerText = dummyLac
Dim p As Pcm
For Each p In pcmCol
If CType(kid, XmlNode).InnerText = p.oldIndex Then
CType(kid, XmlNode).InnerText = Regex.Replace(CType(kid, XmlNode).InnerText, _
CType(kid, XmlNode).InnerText, p.newIndex)
Exit For
End If
Next p
End If
If CType(attrnode, XmlNode).Value = "channel6Pcm" Then
' CType(kid, XmlNode).InnerText = dummyLac
Dim p As Pcm
For Each p In pcmCol
If CType(kid, XmlNode).InnerText = p.oldIndex Then
CType(kid, XmlNode).InnerText = Regex.Replace(CType(kid, XmlNode).InnerText, _
CType(kid, XmlNode).InnerText, p.newIndex)
Exit For
End If
Next p
End If
If CType(attrnode, XmlNode).Value = "channel7Pcm" Then
' CType(kid, XmlNode).InnerText = dummyLac
Dim p As Pcm
For Each p In pcmCol
If CType(kid, XmlNode).InnerText = p.oldIndex Then
CType(kid, XmlNode).InnerText = Regex.Replace(CType(kid, XmlNode).InnerText, _
CType(kid, XmlNode).InnerText, p.newIndex)
Exit For
End If
Next p
End If
Next attrnode
End If
If kid.HasChildNodes = True Then
Dim kid2 As Object
For Each kid2 In kid.ChildNodes
If kid2.HasChildNodes = True Then
Dim kid3 As Object
For Each kid3 In kid2.ChildNodes
'lb.Items.Add(CType(kid, XmlNode).Name)
If CType(kid3, XmlNode).Name = "p" Then
Dim map As XmlNamedNodeMap = kid3.Attributes
Dim attrnode As Object
For Each attrnode In map
'chPcm
If CType(attrnode, XmlNode).Value = "chPcm" Then
' CType(kid, XmlNode).InnerText = dummyLac
Dim p As Pcm
For Each p In pcmCol
If CType(kid3, XmlNode).InnerText = p.oldIndex Then
CType(kid3, XmlNode).InnerText = Regex.Replace(CType(kid3, XmlNode).InnerText, _
CType(kid3, XmlNode).InnerText, p.newIndex)
Exit For
End If
Next p
End If
Next attrnode
End If
Next kid3
End If
Next kid2
End If
Next kid
End If
End Sub
Public Sub changePcmInLapd(ByVal node As XmlNode)
If node.HasChildNodes = True Then
Dim kid As Object
For Each kid In node.ChildNodes
'lb.Items.Add(CType(kid, XmlNode).Name)
If CType(kid, XmlNode).Name = "p" Then
Dim map As XmlNamedNodeMap = kid.Attributes
Dim attrnode As Object
For Each attrnode In map
If CType(attrnode, XmlNode).Value = "abisSigChannelTimeSlotPcm" Then
' CType(kid, XmlNode).InnerText = dummyLac
'abisSigChannelTimeSlotPcm
Dim p As Pcm
For Each p In pcmCol
If CType(kid, XmlNode).InnerText = p.oldIndex Then
CType(kid, XmlNode).InnerText = Regex.Replace(CType(kid, XmlNode).InnerText, _
CType(kid, XmlNode).InnerText, p.newIndex)
Exit For
End If
Next p
End If
Next attrnode
End If
Next kid
End If
End Sub
Public Function getNewBcfIdForLapd(ByVal oldname As String) As String
' need to convert to int from hex
Dim newbcfid As String = ""
Dim bf As Bcf
For Each bf In chgBcfCol
' Dim bcfinhex As String = Conversion.Hex(bf.oldIndex)
'MsgBox("Oldname: " & oldname & " bcfid old: " & newbcfid)
If Conversion.Hex(bf.oldIndex) = oldname Then
Try
newbcfid = Conversion.Hex(bf.newIndex)
'MsgBox("newname: " & newbcfid)
Catch ex As Exception
MsgBox("new bcfid conversion error: " & ex.Message)
End Try
End If
Next bf
Return newbcfid
End Function
Public Sub changeLapdLinkNameInBcf(ByVal node As XmlNode, ByVal lb As ListBox, ByVal sb As StatusBar)
If node.HasChildNodes = True Then
Dim kid As Object
For Each kid In node.ChildNodes
'lb.Items.Add(CType(kid, XmlNode).Name)
If CType(kid, XmlNode).Name = "p" Then
Dim map As XmlNamedNodeMap = kid.Attributes
Dim attrnode As Object
For Each attrnode In map
If CType(attrnode, XmlNode).Value = "lapdLinkName" Then
'MsgBox("match lapd node!")
'get name and transform to new name based on BCFID
'1. get name
Dim lapdName As Match
lapdName = Regex.Match(CType(kid, XmlNode).InnerText, "BS[0-9A-F]{3}")
'MsgBox("LAPD Name: " & lapdName.Value)
'1.1 determine whether bcf lapd or trx lapd
Dim lapdType As Match
lapdType = Regex.Match(CType(kid, XmlNode).InnerText, "BS")
' MsgBox("Type: " & lapdType.Value)
If lapdType.Value = "BS" Then
' MsgBox("LAPD Name: " & lapdName.Value & " TYPE: BCF")
'3. If BCF lapd (begins with U)
'3.1 get old BCFID
'3.2 remove leading zeros from old bcfid
Dim oldname As String = lapdName.Value
oldname = Regex.Replace(oldname, "BS00", "")
oldname = Regex.Replace(oldname, "BS0", "")
oldname = Regex.Replace(oldname, "BS", "")
'MsgBox("old bcf: " & oldname & " original value: " & lapdName.Value)
'Dim newbcfid As String = getNewBcfIdForLapd(oldname)
'3.3 match old bcfid with new bcfid
'3.3.1 pad new bcfid with leading zeroes if necessary
'3.4 concat U & new bfid
Dim newbcfid As String = getNewBcfIdForLapd(oldname)
Dim replacementName As String
If newbcfid <> "" Then
If newbcfid.Length = 3 Then
Dim newname As String = "BS" & newbcfid
replacementName = newname
CType(kid, XmlNode).InnerText = newname
'MsgBox("old lapd name: " & lapdName.Value & " New lapd name: " & newname)
ElseIf newbcfid.Length = 2 Then
Dim newname As String = "BS0" & newbcfid
replacementName = newname
CType(kid, XmlNode).InnerText = newname
'MsgBox("old lapd name: " & lapdName.Value & " New lapd name: " & newname)
ElseIf newbcfid.Length = 1 Then
Dim newname As String = "BS00" & newbcfid
replacementName = newname
CType(kid, XmlNode).InnerText = newname
'MsgBox("old lapd name: " & lapdName.Value & " New lapd name: " & newname)
Else
MsgBox("Error producing new LAPD name - length not 1-3")
End If
Else
' MsgBox("Error in BCF ID match routine!")
End If
Else
MsgBox("Error in BCF LAPD BCFID match routine! Could not match U or T")
End If 'End of if/elseif/else block T or U
End If ' attribute is name
Next attrnode
End If ' is p element
Next kid
End If 'childnodes
End Sub
' ###### SF 23/08/24 ###### below 3 functions are added for Airscale work.
' added below for changing ETP in BCF. Working 22/08/24
Public Sub changeETPinBCF(ByVal node As XmlNode)
If node.HasChildNodes = True Then
Dim kid As Object
For Each kid In node.ChildNodes
If CType(kid, XmlNode).Name = "p" Then
Dim map As XmlNamedNodeMap = kid.Attributes
Dim attrnode As Object
For Each attrnode In map
If CType(attrnode, XmlNode).Value = "usedEtpId" Then
CType(kid, XmlNode).InnerText = "255"
End If
Next attrnode
End If
Next kid
End If
End Sub
' Adds a new <p> element with name="logicalBcxuAddress" to all "managedObject" elements with class="BCF"
Public Sub AddLogicalBcxuAddressElement(ByVal node As XmlNode)
If node.Name = "managedObject" AndAlso node.Attributes IsNot Nothing Then
Dim classAttr As XmlAttribute = node.Attributes("class")
If classAttr IsNot Nothing AndAlso classAttr.Value = "BCF" Then
' Create the new <p> element within the same namespace as the parent node
Dim newElement As XmlElement = node.OwnerDocument.CreateElement("p", node.NamespaceURI)
newElement.SetAttribute("name", "logicalBcxuAddress")
newElement.InnerText = "1"
node.AppendChild(newElement)
End If
End If
' Recursively call the function for child nodes
If node.HasChildNodes Then
For Each childNode As XmlNode In node.ChildNodes
AddLogicalBcxuAddressElement(childNode)
Next
End If
End Sub
' Adds attribute "primaryBcf" to all "bts" elements
Public Sub AddPrimaryBCF(ByVal node As XmlNode)
If node.Name = "managedObject" AndAlso node.Attributes IsNot Nothing Then
Dim classAttr As XmlAttribute = node.Attributes("class")
If classAttr IsNot Nothing AndAlso classAttr.Value = "BTS" Then
' Create the new <p> element within the same namespace as the parent node
Dim newElement As XmlElement = node.OwnerDocument.CreateElement("p", node.NamespaceURI)
newElement.SetAttribute("name", "primaryBcf")
newElement.InnerText = "1"
node.AppendChild(newElement)
End If
End If
' Recursively call the function for child nodes
If node.HasChildNodes Then
For Each childNode As XmlNode In node.ChildNodes
AddPrimaryBCF(childNode)
Next
End If
End Sub
Public Sub changeLapdLinkNameInTrx(ByVal node As XmlNode)
If node.HasChildNodes = True Then
Dim kid As Object
For Each kid In node.ChildNodes
'lb.Items.Add(CType(kid, XmlNode).Name)
If CType(kid, XmlNode).Name = "p" Then
Dim map As XmlNamedNodeMap = kid.Attributes
Dim attrnode As Object
For Each attrnode In map
If CType(attrnode, XmlNode).Value = "lapdLinkName" Then
'MsgBox("match lapd node!")
'get name and transform to new name based on BCFID
'1. get name
Dim lapdNameBcf As String
lapdNameBcf = Regex.Match(CType(kid, XmlNode).InnerText, "T(?<bcf>([A-F0-9]{3}))(?<trx>([A-Z0-9]{1}))").Groups("bcf").ToString
'MsgBox("LAPD Name: " & lapdName.Value)
'1.1 determine whether bcf lapd or trx lapd
Dim lapdType As Match
lapdType = Regex.Match(CType(kid, XmlNode).InnerText, "T")
' MsgBox("Type: " & lapdType.Value)
If lapdType.Value = "T" Then
'MsgBox("LAPD Name: " & lapdName.Value & " TYPE: TRX")
Dim oldname As String = lapdNameBcf
'need TRXID if type = T
Dim trxid As String
trxid = Regex.Match(CType(kid, XmlNode).InnerText, "T(?<bcf>([A-F0-9]{3}))(?<trx>([A-Z0-9]{1}))").Groups("trx").ToString
lapdNameBcf = Regex.Replace(lapdNameBcf, "^00", "")
lapdNameBcf = Regex.Replace(lapdNameBcf, "^0", "")
' MsgBox("TRXBCF: " & oldName3)
Dim newbcfid As String = getNewBcfIdForLapd(lapdNameBcf)
If newbcfid <> "" Then
If newbcfid.Length = 3 Then
Dim newname As String = "T" & newbcfid & trxid
CType(kid, XmlNode).InnerText = newname
'MsgBox("old lapd name: " & lapdName.Value & " New lapd name: " & newname)
ElseIf newbcfid.Length = 2 Then
Dim newname As String = "T0" & newbcfid & trxid
CType(kid, XmlNode).InnerText = newname
'MsgBox("old lapd name: " & lapdName.Value & " New lapd name: " & newname)
ElseIf newbcfid.Length = 1 Then
Dim newname As String = "T00" & newbcfid & trxid
CType(kid, XmlNode).InnerText = newname
'MsgBox("old lapd name: " & lapdName.Value & " New lapd name: " & newname)
Else
MsgBox("Error producing new LAPD name - BCFID length not 1-3")
End If
End If
Else
MsgBox("Error in TRX LAPD BCFID match routine! Could not match T")
End If 'End of if/elseif/else block T
End If ' attribute is name
Next attrnode
End If ' is p element
Next kid
End If 'childnodes
End Sub
Public Sub removeTargetCellDN(ByVal node As XmlNode)
Dim modCNum As String = "BSC-" & newCNum
Dim oldCNumStr As String = "BSC-" & oldCNum
If node.HasChildNodes = True Then
Dim kid As Object
For Each kid In node.ChildNodes
'lb.Items.Add(CType(kid, XmlNode).Name)
If CType(kid, XmlNode).Name = "p" Then
Dim map As XmlNamedNodeMap = kid.Attributes
Dim attrnode As Object
Dim found As Boolean
For Each attrnode In map
If CType(attrnode, XmlNode).Value = "targetCellDN" Then
node.RemoveChild(kid)
End If
Next attrnode
End If
Next kid
End If
End Sub
Public Sub changeCNumAdjwSwap(ByVal node As XmlNode, ByVal lb As ListBox, ByVal sb As StatusBar)
Dim modCNum As String = "BSC-" & newCNum
Dim oldCNumStr As String = "BSC-" & oldCNum
If XmlNodeType.Element = node.NodeType Then
'If CType(node, XmlNode).Name = "managedObject" Then
Dim map As XmlNamedNodeMap = node.Attributes
Dim attrnode As Object
For Each attrnode In map
If CType(attrnode, XmlNode).Name = "distName" Then
CType(attrnode, XmlNode).Value = Regex.Replace(CType(attrnode, XmlNode).Value, _
oldCNumStr, modCNum)
End If
If CType(attrnode, XmlNode).Name = "version" Then
CType(attrnode, XmlNode).Value = Regex.Replace(CType(attrnode, XmlNode).Value, _
CType(attrnode, XmlNode).Value, SwVersion)
End If
' If CType(attrnode, XmlNode).Name = "id" Then
' node.Attributes.Remove(attrnode)
'End If
Next attrnode
'End If
End If
End Sub
End Module