update at 2023/08/14

This commit is contained in:
2023-08-14 21:41:37 +08:00
parent a039a664f1
commit 44e8cbee2c
255 changed files with 20426 additions and 233 deletions

View File

@@ -0,0 +1,48 @@
<?xml version="1.0" encoding="UTF-8"?>
<DataFile xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="file:///./cm-schema.xsd">
<FileHeader>
<TimeStamp>2023-05-17 10:16:17</TimeStamp>
<TimeZone>UTC+8</TimeZone>
<VendorName>Ruijie Network</VendorName>
<ElementType>SMF</ElementType>
<CmVersion>16.1.1</CmVersion>
</FileHeader>
<Objects>
<ObjectType>ManagedElement</ObjectType>
<FieldName>
<N i="1">Id</N>
<N i="2">Id</N>
<N i="3">Id</N>
<N i="4">Id</N>
<N i="5">Id</N>
<N i="6">Id</N>
<N i="7">Id</N>
<N i="8">Id</N>
<N i="9">Id</N>
</FieldName>
<FieldValue>
<Object rmUID="1000HXSMF001" Dn="DC=www.ruijie.com.cn,SubNetwork=10001,SubNetwork=114214,ManagedElement=325" UserLabel="SMF_BJ_JC001" PVFlag="VNF" VMID="kylin10.0-001-SMF" VNFInstanceID="2bdd55b4-9018-41f4-af35-28b6828788">
<V i="1">SMF</V>
<V i="2">SMF</V>
<V i="3">SMF</V>
<V i="4">SMF</V>
<V i="5">SMF</V>
<V i="6">SMF</V>
<V i="7">SMF</V>
<V i="8">SMF</V>
<V i="9">SMF</V>
</Object>
<Object rmUID="1000HXSMF002" Dn="DC=www.ruijie.com.cn,SubNetwork=10001,SubNetwork=114214,ManagedElement=325" UserLabel="SMF_BJ_JC001" PVFlag="VNF" VMID="kylin10.0-002-SMF" VNFInstanceID="2bdd55b4-9018-41f4-af35-28b6828788">
<V i="1">SMF</V>
<V i="2">SMF</V>
<V i="3">SMF</V>
<V i="4">SMF</V>
<V i="5">SMF</V>
<V i="6">SMF</V>
<V i="7">SMF</V>
<V i="8">SMF</V>
<V i="9">SMF</V>
</Object>
</FieldValue>
</Objects>
</DataFile>

48
tools/xsdgen/cm-demo.xml Normal file
View File

@@ -0,0 +1,48 @@
<?xml version="1.0" encoding="UTF-8"?>
<DataFile xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="file:///./cm-schema.xsd">
<FileHeader>
<TimeStamp>2023-05-17 09:57:17</TimeStamp>
<TimeZone>UTC+8</TimeZone>
<VendorName>Ruijie Network</VendorName>
<ElementType>SMF</ElementType>
<CmVersion>16.1.1</CmVersion>
</FileHeader>
<Objects>
<ObjectType>ManagedElement</ObjectType>
<FieldName>
<N i="1">Id</N>
<N i="2">Id</N>
<N i="3">Id</N>
<N i="4">Id</N>
<N i="5">Id</N>
<N i="6">Id</N>
<N i="7">Id</N>
<N i="8">Id</N>
<N i="9">Id</N>
</FieldName>
<FieldValue>
<Object rmUID="1000HXSMF001" Dn="DC=www.ruijie.com.cn,SubNetwork=10001,SubNetwork=114214,ManagedElement=325" UserLabel="SMF_BJ_JC001" PVFlag="VNF" VMID="kylin10.0-001-SMF" VNFInstanceID="2bdd55b4-9018-41f4-af35-28b6828788">
<V i="1">SMF</V>
<V i="2">SMF</V>
<V i="3">SMF</V>
<V i="4">SMF</V>
<V i="5">SMF</V>
<V i="6">SMF</V>
<V i="7">SMF</V>
<V i="8">SMF</V>
<V i="9">SMF</V>
</Object>
<Object rmUID="1000HXSMF002" Dn="DC=www.ruijie.com.cn,SubNetwork=10001,SubNetwork=114214,ManagedElement=325" UserLabel="SMF_BJ_JC001" PVFlag="VNF" VMID="kylin10.0-002-SMF" VNFInstanceID="2bdd55b4-9018-41f4-af35-28b6828788">
<V i="1">SMF</V>
<V i="2">SMF</V>
<V i="3">SMF</V>
<V i="4">SMF</V>
<V i="5">SMF</V>
<V i="6">SMF</V>
<V i="7">SMF</V>
<V i="8">SMF</V>
<V i="9">SMF</V>
</Object>
</FieldValue>
</Objects>
</DataFile>

66
tools/xsdgen/cm-schema.go Normal file
View File

@@ -0,0 +1,66 @@
// Code generated by xgen. DO NOT EDIT.
package main
// FileHeader ...
type FileHeader struct {
TimeStamp string `xml:"TimeStamp"`
TimeZone string `xml:"TimeZone"`
VendorName string `xml:"VendorName"`
ElementType string `xml:"ElementType"`
CmVersion string `xml:"CmVersion"`
}
// N ...
type N struct {
IAttr int `xml:"i,attr"`
Value string `xml:",chardata"`
}
// FieldName ...
type FieldName struct {
N []N `xml:"N"`
}
// V ...
type V struct {
IAttr int `xml:"i,attr"`
Value string `xml:",chardata"`
}
// Object ...
type Object struct {
RmUIDAttr string `xml:"rmUID,attr"`
DnAttr string `xml:"Dn,attr,omitempty"`
UserLabelAttr string `xml:"UserLabel,attr,omitempty"`
PVFlagAttr string `xml:"PVFlag,attr"`
VMIDAttr string `xml:"VMID,attr,omitempty"`
VNFInstanceIDAttr string `xml:"VNFInstanceID,attr,omitempty"`
V []V `xml:"V"`
}
// FieldValue ...
type FieldValue struct {
Object []Object `xml:"Object"`
}
// Objects ...
type Objects struct {
ObjectType string `xml:"ObjectType"`
FieldName FieldName `xml:"FieldName"`
FieldValue FieldValue `xml:"FieldValue"`
}
// DataFile ...
type DataFile struct {
FileHeader FileHeader `xml:"FileHeader"`
Objects Objects `xml:"Objects"`
XsiAttr string `xml:"xmlns:xsi,attr"`
XsiLoc string `xml:"xsi:noNamespaceSchemaLocation,attr"`
}
// NRM xml file
type NRMXmlFile struct {
Header string `xml:"Header"`
DataFile DataFile `xml:"xmlns:xsi"`
}

View File

@@ -0,0 +1,76 @@
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" elementFormDefault="qualified" attributeFormDefault="unqualified">
<xs:element name="DataFile">
<xs:complexType>
<xs:sequence>
<xs:element name="FileHeader">
<xs:complexType>
<xs:sequence>
<xs:element name="TimeStamp" type="xs:dateTime"/>
<xs:element name="TimeZone" type="xs:string"/>
<xs:element name="VendorName" type="xs:string" minOccurs="0"/>
<xs:element name="ElementType" type="xs:string" minOccurs="0"/>
<xs:element name="CmVersion" type="xs:string" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="Objects" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="ObjectType" type="xs:string"/>
<!--该字段必选-->
<xs:element name="FieldName">
<xs:complexType>
<xs:sequence minOccurs="0" maxOccurs="unbounded">
<xs:element name="N">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute name="i" type="xs:integer" use="required"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="FieldValue">
<xs:complexType>
<xs:sequence minOccurs="0" maxOccurs="unbounded">
<xs:element name="Object">
<xs:complexType>
<xs:sequence minOccurs="0" maxOccurs="unbounded">
<xs:element name="V">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute name="i" type="xs:integer" use="required"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="rmUID" type="xs:string" use="required"/>
<xs:attribute name="Dn" type="xs:string"/>
<!-- //无线、核心网专业该字段必选传输、IP专业、业务系统无该字段-->
<xs:attribute name="UserLabel" type="xs:string"/>
<!-- //无线、核心网专业该字段必选传输、IP专业、业务系统无该字段-->
<xs:attribute name="PVFlag" type="xs:string" use="required"/>
<!-- //必须-->
<xs:attribute name="VMID" type="xs:string"/>
<!-- //VNF网络或VNF和PNF混合组网虚拟网元必选物理网元无该字段-->
<xs:attribute name="VNFInstanceID" type="xs:string"/>
<!-- //VNF网络或VNF和PNF混合组网虚拟网元必选物理网元无该字段-->
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>

66
tools/xsdgen/genxml.go Normal file
View File

@@ -0,0 +1,66 @@
package main
import (
"encoding/xml"
"fmt"
"io/ioutil"
"strconv"
"time"
)
const (
// Header is a generic XML header suitable for use with the output of Marshal.
// This is not automatically added to any output of this package,
// it is provided as a convenience.
Header = `<?xml version="1.0" encoding="UTF-8"?>` + "\n"
)
func main() {
t := time.Now()
timestamp := t.Format("2006-01-02 15:04:05")
timefile := t.Format("20060102150405")
_, offset := t.Zone()
var tzOffset string
if offset >= 0 {
tzOffset = "UTC+" + strconv.Itoa(offset/3600)
} else {
tzOffset = "UTC" + strconv.Itoa(offset/3600)
}
nrmFile := new(DataFile)
nrmFile.FileHeader = FileHeader{
TimeStamp: timestamp,
TimeZone: tzOffset,
VendorName: "Ruijie Network",
ElementType: "SMF",
CmVersion: "16.1.1",
}
nrmFile.XsiAttr = "http://www.w3.org/2001/XMLSchema-instance"
nrmFile.XsiLoc = "file:///usr/loal/omc/etc/schema/cm-schema.xsd"
nrmFile.Objects.ObjectType = "ManagedElement"
for i := 1; i < 10; i++ {
nrmFile.Objects.FieldName.N = append(nrmFile.Objects.FieldName.N, N{IAttr: i, Value: "Id"})
}
object := Object{RmUIDAttr: "1000HXSMF001",
DnAttr: "DC=www.ruijie.com.cn,SubNetwork=10001,SubNetwork=114214,ManagedElement=325",
UserLabelAttr: "SMF_BJ_JC001", PVFlagAttr: "VNF", VMIDAttr: "kylin10.0-001-SMF", VNFInstanceIDAttr: "2bdd55b4-9018-41f4-af35-28b6828788"}
for i := 1; i < 10; i++ {
object.V = append(object.V, V{IAttr: i, Value: "SMF"})
}
nrmFile.Objects.FieldValue.Object = append(nrmFile.Objects.FieldValue.Object, object)
object = Object{RmUIDAttr: "1000HXSMF002",
DnAttr: "DC=www.ruijie.com.cn,SubNetwork=10001,SubNetwork=114214,ManagedElement=325",
UserLabelAttr: "SMF_BJ_JC001", PVFlagAttr: "VNF", VMIDAttr: "kylin10.0-002-SMF", VNFInstanceIDAttr: "2bdd55b4-9018-41f4-af35-28b6828788"}
for i := 1; i < 10; i++ {
object.V = append(object.V, V{IAttr: i, Value: "SMF"})
}
nrmFile.Objects.FieldValue.Object = append(nrmFile.Objects.FieldValue.Object, object)
x, _ := xml.MarshalIndent(nrmFile, "", " ")
x = append([]byte(xml.Header), x...)
cmfile := fmt.Sprintf("./CM-HX-V%s-%s.xml", "16.1.1", timefile)
ioutil.WriteFile(cmfile, x, 0664)
}

View File

@@ -0,0 +1,80 @@
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
elementFormDefault="qualified" attributeFormDefault="unqualified">
<xs:element name="PmFile">
<xs:complexType>
<xs:sequence>
<xs:element name="FileHeader">
<xs:complexType>
<xs:sequence>
<xs:element name="TimeStamp" type="xs:dateTime" />
<xs:element name="TimeZone" type="xs:string" />
<xs:element name="Period" type="xs:integer" />
<xs:element name="VendorName" type="xs:string" />
<xs:element name="ElementType" type="xs:string" />
<xs:element name="PmVersion" type="xs:string" />
<xs:element name="StartTime" type="xs:dateTime" />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="Measurements" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="ObjectType" type="xs:string" />
<xs:element name="PmName">
<xs:complexType>
<xs:sequence minOccurs="0" maxOccurs="unbounded">
<xs:element name="N">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute name="i" type="xs:integer" use="required" />
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="PmData">
<xs:complexType>
<xs:sequence minOccurs="0" maxOccurs="unbounded">
<xs:element name="Object">
<xs:complexType>
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:element name="V">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute name="i" type="xs:integer" use="required" />
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
<xs:element name="CV">
<xs:complexType>
<xs:sequence minOccurs="0" maxOccurs="unbounded">
<xs:element name="SN" type="xs:string" />
<xs:element name="SV" type="xs:string" />
</xs:sequence>
<xs:attribute name="i" type="xs:integer"
use="required" />
</xs:complexType>
</xs:element>
</xs:choice>
<xs:attribute name="rmUID" type="xs:string" use="required" />
<xs:attribute name="Dn" type="xs:string" use="required" />
<xs:attribute name="UserLabel" type="xs:string" use="required" />
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>

3
tools/xsdgen/xsdgen.go Normal file
View File

@@ -0,0 +1,3 @@
// Code generated by xgen. DO NOT EDIT.
package schema