diff --git a/ParsersReparent2_0.vb b/ParsersReparent2_0.vb new file mode 100644 index 0000000..71434fa --- /dev/null +++ b/ParsersReparent2_0.vb @@ -0,0 +1,1387 @@ +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 + '
6251
remove element + '85
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 + '6251
remove element + '85
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-(?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
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
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(?