Commit 729e6730 authored by chenty's avatar chenty

Fixed a bug in xml interpreter

parent 0c24e926
{
"sim":{
"userClass":{
"name":"Class1",
"priority":"0",
"referenceSource":"Source 1",
"type":"open"
},
"node":[
{
"section":[
{
"parameter":{
"refClass":"Class1",
"subParameter":{
"subParameter":[
{
"name":"Exponential"
},
{
"subParameter":{
"value":"1.0"
}
}
]
}
},
"className":"RandomSource"
},
{
"className":"ServiceTunnel"
},
{
"parameter":{
"refClass":"Class1",
"subParameter":{
"name":"Random"
}
},
"className":"Router"
}
],
"name":"Source 1"
},
{
"section":[
{
"parameter":[
{
"value":"-1",
"name": "size"
},
{
"refClass":"Class1",
"subParameter":{
"value":"drop"
}
},
{
"refClass":"Class1",
"subParameter":{
"name":"TailStrategy"
}
}
],
"className":"Queue"
},
{
"parameter":[
{
"value":"1"
},
{
"refClass":"Class1",
"subParameter":{
"value":"1"
}
},
{
"refClass":"Class1",
"subParameter":{
"subParameter":[
{
"name":"Exponential"
},
{
"subParameter":{
"value":"2.0"
}
}
]
}
}
],
"className":"Server"
},
{
"parameter":{
"refClass":"Class1",
"subParameter":{
"name":"Random"
}
},
"className":"Router"
}
],
"name":"Queue 1"
},
{"section": {
"className": "JobSink"
},
"name": "Sink 1"
}
],
"measure":{
"alpha":"0.01",
"name":"System Response Time",
"nodeType":"",
"precision":"0.03",
"referenceNode":"",
"referenceUserClass":"",
"type":"System Response Time",
"verbose":"false"
},
"connection":[
{
"source":"Source 1",
"target":"Queue 1"
},
{
"source":"Queue 1",
"target":"Sink 1"
}
],
"disableStatisticStop":"false",
"logDecimalSeparator":".",
"logDelimiter":";",
"logPath":"/Users/hongshuliu/JMT/",
"logReplaceMode":"0",
"maxEvents":"-1",
"maxSamples":"1000000",
"name":"simplequeue.jsimg.jsimw",
"polling":"1.0",
"seed":"23000",
"xsi:noNamespaceSchemaLocation":"SIMmodeldefinition.xsd"
},
"jmodel":{
"xsi:noNamespaceSchemaLocation":"JModelGUI.xsd"
},
"xmlns:xsi":"http://www.w3.org/2001/XMLSchema-instance",
"name":"simplequeue.jsimg.jsimw",
"timestamp":"Fri Apr 17 18:50:37 CST 2020",
"xsi:noNamespaceSchemaLocation":"Archive.xsd"
}
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
......@@ -3,7 +3,7 @@
"userClass":{
"name":"Class1",
"priority":"0",
"referenceSource":"Source",
"referenceSource":"Source 1",
"type":"open"
},
"node":[
......@@ -40,20 +40,15 @@
"className":"Router"
}
],
"name":"Source"
},
{
"section":{
"className":"JobSink"
},
"name":"Sink"
"name":"Source 1"
},
{
"section":[
{
"parameter":[
{
"value":"-1"
"value":"-1",
"name": "size"
},
{
"refClass":"Class1",
......@@ -64,7 +59,7 @@
{
"refClass":"Class1",
"subParameter":{
"value":"TailStrategy"
"name":"TailStrategy"
}
}
],
......@@ -110,6 +105,11 @@
}
],
"name":"Queue 1"
},
{"section": {
"className": "JobSink"
},
"name": "Sink 1"
}
],
"measure":{
......@@ -124,12 +124,12 @@
},
"connection":[
{
"source":"Source",
"source":"Source 1",
"target":"Queue 1"
},
{
"source":"Queue 1",
"target":"Sink"
"target":"Sink 1"
}
],
"disableStatisticStop":"false",
......
......@@ -9,15 +9,17 @@ this module works at best speed using python 3.3 and above
"""
import json as js
from xml.dom import minidom
import xml.etree.ElementTree as ET
from datetime import datetime
import tempfile
import utility.xmlinterpreter.attributes as ab
import json as js
import utility.xmlinterpreter.guiconstant as gc
from datetime import datetime
import xml.etree.ElementTree as ET
import utility.xmlinterpreter.simconstant as sc
import utility.xmlinterpreter.attributes as ab
from jsonschema import validate
from utility.xmlinterpreter.schema.pn_schema import pn_schema
from utility.xmlinterpreter.schema.queue_schema import queue_schema
from jsonschema import validate
......@@ -405,7 +407,7 @@ def queue(root, data, n):
if p.attrib['name'] == "RoutingStrategy":
refclass = ET.SubElement(p, sc.XML_E_PARAMETER_REFCLASS)
refclass.text = data['sim']['node'][n]['section'][2]['parameter']['refClass']
subpara_que_router = ET.SubElement(p, sc.XML_E_SUBPARAMETER, queue_param_router)
subpara_que_router = ET.SubElement(p, sc.XML_E_SUBPARAMETER, queue_subpara_router)
def validate_json(in_file, schema):
......
......@@ -161,29 +161,6 @@
"name"
]
},
{
"type": "object",
"properties": {
"section": {
"type": "object",
"properties": {
"className": {
"type": "string"
}
},
"required": [
"className"
]
},
"name": {
"type": "string"
}
},
"required": [
"section",
"name"
]
},
{
"type": "object",
"properties": {
......@@ -201,10 +178,14 @@
"properties": {
"value": {
"type": "string"
},
"name": {
"type": "string"
}
},
"required": [
"value"
"value",
"name"
]
},
{
......@@ -239,12 +220,12 @@
"subParameter": {
"type": "object",
"properties": {
"value": {
"name": {
"type": "string"
}
},
"required": [
"value"
"name"
]
}
},
......@@ -415,6 +396,29 @@
"section",
"name"
]
},
{
"type": "object",
"properties": {
"section": {
"type": "object",
"properties": {
"className": {
"type": "string"
}
},
"required": [
"className"
]
},
"name": {
"type": "string"
}
},
"required": [
"section",
"name"
]
}
]
},
......
......@@ -186,29 +186,6 @@ queue_schema = {
"name"
]
},
{
"type": "object",
"properties": {
"section": {
"type": "object",
"properties": {
"className": {
"type": "string"
}
},
"required": [
"className"
]
},
"name": {
"type": "string"
}
},
"required": [
"section",
"name"
]
},
{
"type": "object",
"properties": {
......@@ -226,10 +203,14 @@ queue_schema = {
"properties": {
"value": {
"type": "string"
},
"name": {
"type": "string"
}
},
"required": [
"value"
"value",
"name"
]
},
{
......@@ -264,12 +245,12 @@ queue_schema = {
"subParameter": {
"type": "object",
"properties": {
"value": {
"name": {
"type": "string"
}
},
"required": [
"value"
"name"
]
}
},
......@@ -440,6 +421,29 @@ queue_schema = {
"section",
"name"
]
},
{
"type": "object",
"properties": {
"section": {
"type": "object",
"properties": {
"className": {
"type": "string"
}
},
"required": [
"className"
]
},
"name": {
"type": "string"
}
},
"required": [
"section",
"name"
]
}
]
},
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment