diff --git a/simulator/input/cp.yaml b/simulator/input/cp.yaml new file mode 100644 index 0000000..ce30c9e --- /dev/null +++ b/simulator/input/cp.yaml @@ -0,0 +1,137 @@ +patterns: + Crypto: + cptype: simple + edges: [] + extedges: [] + funcs: + - class: srvRsp + label: cryptoProcess + name: Crypto + services: + decrypt: + cp: '' + label: cryptoProcess + Embedded: + cptype: simple + edges: + - dstcp: Embedded + dstlabel: reqDecrypt + msgtype: decrypt + srccp: Embedded + srclabel: validateSrc + - dstcp: Embedded + dstlabel: embeddedProcess + msgtype: process + srccp: Embedded + srclabel: reqDecrypt + - dstcp: Embedded + dstlabel: reqEncrypt + msgtype: encrypt + srccp: Embedded + srclabel: embeddedProcess + extedges: + - dstcp: HMI + dstlabel: validateSrc + msgtype: results + srccp: Embedded + srclabel: reqEncrypt + funcs: + - class: srvReq + label: validateSrc + - class: srvReq + label: reqDecrypt + - class: processPckt + label: embeddedProcess + - class: srvReq + label: reqEncrypt + name: Embedded + services: + auth: + cp: EmbeddedAuth + label: authenticate + EmbeddedAuth: + cptype: simple + edges: [] + extedges: [] + funcs: + - class: srvRsp + label: authenticate + name: EmbeddedAuth + services: {} + HMI: + cptype: simple + edges: + - dstcp: HMI + dstlabel: startMeasure + msgtype: measure + srccp: HMI + srclabel: startThread + - dstcp: HMI + dstlabel: generatePckt + msgtype: generate + srccp: HMI + srclabel: startMeasure + - dstcp: HMI + dstlabel: accelEncrypt + msgtype: encrypt + srccp: HMI + srclabel: generatePckt + - dstcp: HMI + dstlabel: accelDecrypt + msgtype: decrypt + srccp: HMI + srclabel: validateSrc + - dstcp: HMI + dstlabel: processRtn + msgtype: process + srccp: HMI + srclabel: accelDecrypt + - dstcp: HMI + dstlabel: endMeasure + msgtype: measure + srccp: HMI + srclabel: processRtn + - dstcp: HMI + dstlabel: endThread + msgtype: finish + srccp: HMI + srclabel: endMeasure + extedges: + - dstcp: Embedded + dstlabel: validateSrc + msgtype: compute + srccp: HMI + srclabel: accelEncrypt + funcs: + - class: start + label: startThread + - class: measure + label: startMeasure + - class: processPckt + label: generatePckt + - class: processPckt + label: accelEncrypt + - class: srvReq + label: validateSrc + - class: processPckt + label: accelDecrypt + - class: processPckt + label: processRtn + - class: measure + label: endMeasure + - class: finish + label: endThread + name: HMI + services: + auth: + cp: HMIAuth + label: authenticate + HMIAuth: + cptype: simple + edges: [] + extedges: [] + funcs: + - class: srvRsp + label: authenticate + name: HMIAuth + services: {} diff --git a/simulator/input/cpInit.yaml b/simulator/input/cpInit.yaml new file mode 100644 index 0000000..066d9cb --- /dev/null +++ b/simulator/input/cpInit.yaml @@ -0,0 +1,86 @@ +dictname: exampleName +initlist: + Crypto: + cfg: + cryptoProcess: '{"timingcode": {}, "directprefix": ["encrypt", "decrypt"], "trace": + 0, "msg2mc": {}}' + cptype: Crypto + msgs: [] + name: Crypto + useyaml: true + Embedded: + cfg: + embeddedProcess: '{"timingcode": {"process": "packet-process"}, "accelname": + "", "trace": 0, "msg2mc": {}, "msg2msg": {}}' + reqDecrypt: '{"bypass": 0, "trace": 0, "srvCP": "Crypto", "srvLabel": "cryptoProcess", + "srvOp": "decrypt-AES-128-CBC", "rspOp": "", "msg2mc": {"*": "default"}, "msg2msg": + {}}' + reqEncrypt: '{"bypass": 0, "trace": 0, "srvCP": "Crypto", "srvLabel": "cryptoProcess", + "srvOp": "encrypt-AES-128-CBC", "rspOp": "", "msg2mc": {"*": "default"}, "msg2msg": + {}}' + validateSrc: '{"bypass": 0, "trace": 0, "srvCP": "", "srvLabel": "", "srvOp": + "auth", "rspOp": "", "msg2mc": {"*": "default"}, "msg2msg": {}}' + cptype: Embedded + msgs: + - ispckt: true + msgtype: decrypt + - ispckt: true + msgtype: process + - ispckt: true + msgtype: encrypt + - ispckt: true + msgtype: results + name: Embedded + useyaml: true + EmbeddedAuth: + cfg: + authenticate: '{"timingcode": {"auth": "authenticate"}, "directprefix": [], + "trace": 0, "msg2mc": {}}' + cptype: EmbeddedAuth + msgs: [] + name: EmbeddedAuth + useyaml: true + HMI: + cfg: + accelDecrypt: '{"timingcode": {"decrypt": "decrypt-AES-128-CBC"}, "accelname": "hmiAccel", + "trace": 1, "msg2mc": {}, "msg2msg": {}}' + accelEncrypt: '{"timingcode": {"encrypt": "encrypt-AES-128-CBC"}, "accelname": "hmiAccel", + "trace": 1, "msg2mc": {}, "msg2msg": {}}' + endMeasure: '{"msrname": "end2end", "msrop": "end", "trace": 0, "msg2mc": {}}' + endThread: '{"trace": 0, "msg2mc": {"finish": "default"}}' + generatePckt: '{"timingcode": {"generate": "packet-generation"}, "accelname": + "", "trace": 1, "msg2mc": {}, "msg2msg": {}}' + processRtn: '{"timingcode": {"process": "packet-return"}, "accelname": "", "trace": + 0, "msg2mc": {}, "msg2msg": {}}' + startMeasure: '{"msrname": "end2end", "msrop": "start", "trace": 0, "msg2mc": + {}}' + startThread: '{"pcktlen": 1000, "msglen": 1500, "msgtype": "measure", "starttime": + 10.0, "data": "", "trace": 0}' + validateSrc: '{"bypass": 0, "trace": 0, "srvCP": "", "srvLabel": "", "srvOp": + "auth", "rspOp": "", "msg2mc": {"*": "default"}, "msg2msg": {}}' + cptype: HMI + msgs: + - ispckt: true + msgtype: measure + - ispckt: true + msgtype: generate + - ispckt: true + msgtype: encrypt + - ispckt: true + msgtype: decrypt + - ispckt: true + msgtype: process + - ispckt: true + msgtype: finish + - ispckt: true + msgtype: compute + name: HMI + useyaml: true + HMIAuth: + cfg: + authenticate: '{"timingcode": {"auth": "authenticate"}, "directprefix": [], + "trace": 0, "msg2mc": {}}' + cptype: HMIAuth + msgs: [] + name: HMIAuth + useyaml: true diff --git a/simulator/input/devExec.yaml b/simulator/input/devExec.yaml new file mode 100644 index 0000000..ca62356 --- /dev/null +++ b/simulator/input/devExec.yaml @@ -0,0 +1,31 @@ +listname: exampleName +times: + switch: + - devop: switch + exectime: 2.5468708882538892e-05 + model: Aruba 3810m + perbyte: 2.0314564440981863e-08 + - devop: switch + exectime: 2.6615850225217655e-05 + model: Netgear GS324T + perbyte: 1.5806828571358056e-08 + - devop: switch + exectime: 2.633975299412786e-05 + model: Netgear GS724T + perbyte: 1.6032781107754593e-08 + - devop: switch + exectime: 2.2973998649851932e-05 + model: Aruba 3810m + perbyte: 2.6475916111960042e-08 + - devop: switch + exectime: 2.3006837790126468e-05 + model: Netgear GJS524e + perbyte: 2.3799811941421118e-08 + - devop: switch + exectime: 2.7641803043648572e-05 + model: Netgear GS324T + perbyte: 2.0314564440981863e-08 + - devop: switch + exectime: 2.8105751672196037e-05 + model: Netgear GS724T + perbyte: 1.7621004694522426e-08 diff --git a/simulator/input/exp.yaml b/simulator/input/exp.yaml new file mode 100644 index 0000000..f804eb6 --- /dev/null +++ b/simulator/input/exp.yaml @@ -0,0 +1,44 @@ +expname: exampleName +parameters: +- attributes: + - attrbname: name + attrbvalue: central + param: latency + paramObj: Network + value: 5e-06 +- attributes: + - attrbname: name + attrbvalue: central + param: bandwidth + paramObj: Network + value: '1000' +- attributes: + - attrbname: name + attrbvalue: central + param: capacity + paramObj: Network + value: '10000' +- attributes: + - attrbname: name + attrbvalue: central + param: trace + paramObj: Network + value: 0 +- attributes: + - attrbname: '*' + attrbvalue: 1 + param: latency + paramObj: Interface + value: 5e-06 +- attributes: + - attrbname: '*' + attrbvalue: 1 + param: bandwidth + paramObj: Interface + value: 10 +- attributes: + - attrbname: '*' + attrbvalue: 1 + param: trace + paramObj: Interface + value: 0 diff --git a/simulator/input/experiments.yaml b/simulator/input/experiments.yaml new file mode 100644 index 0000000..194d319 --- /dev/null +++ b/simulator/input/experiments.yaml @@ -0,0 +1,12 @@ +- $bndwdth,netParams: '1000' + $crypto,cp: AES-256-CBC + name: exp-1 +- $bndwdth,netParams: '10' + $crypto,cp: AES-256-CBC + name: exp-2 +- $bndwdth,netParams: '1000' + $crypto,cp: AES-128-CBC + name: exp-3 +- $bndwdth,netParams: '10' + $crypto,cp: AES-128-CBC + name: exp-4 diff --git a/simulator/input/funcExec.yaml b/simulator/input/funcExec.yaml new file mode 100644 index 0000000..eb3709d --- /dev/null +++ b/simulator/input/funcExec.yaml @@ -0,0 +1,90 @@ +listname: exampleName +times: + authenticate: + - cpumodel: AMD EPYC 9534 64-Core Processor + exectime: 4.0e-06 + identifier: authenticate + param: '' + pcktlen: 1000 + decrypt-AES-128-CBC: + - cpumodel: AMD EPYC 9534 64-Core Processor + exectime: 4.555900999999999e-06 + identifier: decrypt-AES-128-CBC + param: '' + pcktlen: 1500 + - cpumodel: AMD EPYC 9534 64-Core Processor + exectime: 3.097098e-06 + identifier: decrypt-AES-128-CBC + param: '' + pcktlen: 1000 + - cpumodel: AEWIN 0T008 + exectime: 9.111801999999999e-07 + identifier: decrypt-AES-128-CBC + param: '' + pcktlen: 1500 + - cpumodel: AEWIN 0T008 + exectime: 6.194196e-07 + identifier: decrypt-AES-128-CBC + param: '' + pcktlen: 1000 + decrypt-AES-256-CBC: + - cpumodel: AMD EPYC 9534 64-Core Processor + exectime: 6.257925e-07 + identifier: decrypt-AES-256-CBC + param: '' + pcktlen: 128 + - cpumodel: AEWIN 0T008 + exectime: 1.251585e-07 + identifier: decrypt-AES-256-CBC + param: '' + pcktlen: 128 + encrypt-AES-128-CBC: + - cpumodel: AMD EPYC 9534 64-Core Processor + exectime: 5.471041e-06 + identifier: encrypt-AES-128-CBC + param: '' + pcktlen: 1500 + - cpumodel: AMD EPYC 9534 64-Core Processor + exectime: 3.792754e-06 + identifier: encrypt-AES-128-CBC + param: '' + pcktlen: 1000 + - cpumodel: AEWIN 0T008 + exectime: 1.0942082000000001e-06 + identifier: encrypt-AES-128-CBC + param: '' + pcktlen: 1500 + - cpumodel: AEWIN 0T008 + exectime: 7.585508e-07 + identifier: encrypt-AES-128-CBC + param: '' + pcktlen: 1000 + encrypt-AES-256-CBC: + - cpumodel: AMD EPYC 9534 64-Core Processor + exectime: 8.734855e-07 + identifier: encrypt-AES-256-CBC + param: '' + pcktlen: 128 + - cpumodel: AEWIN 0T008 + exectime: 1.7469709999999998e-07 + identifier: encrypt-AES-256-CBC + param: '' + pcktlen: 128 + packet-generation: + - cpumodel: AMD EPYC 9534 64-Core Processor + exectime: 3.2294884e-05 + identifier: packet-generation + param: '' + pcktlen: 1000 + packet-process: + - cpumodel: AMD EPYC 9534 64-Core Processor + exectime: 0.0001 + identifier: packet-process + param: '' + pcktlen: 1000 + packet-return: + - cpumodel: AMD EPYC 9534 64-Core Processor + exectime: 1.0e-05 + identifier: packet-return + param: '' + pcktlen: 1000 diff --git a/simulator/input/map.yaml b/simulator/input/map.yaml new file mode 100644 index 0000000..bfc2196 --- /dev/null +++ b/simulator/input/map.yaml @@ -0,0 +1,33 @@ +dictname: exampleName +map: + Crypto: + funcmap: + cryptoProcess: sslDev,10 + patternname: Crypto + Embedded: + funcmap: + embeddedProcess: embeddedDev,10 + reqDecrypt: embeddedDev,10 + reqEncrypt: embeddedDev,10 + validateSrc: embeddedDev,10 + patternname: Embedded + EmbeddedAuth: + funcmap: + authenticate: embeddedDev,10 + patternname: EmbeddedAuth + HMI: + funcmap: + accelDecrypt: hmiDev,10 + accelEncrypt: hmiDev,10 + endMeasure: hmiDev,10 + endThread: hmiDev,10 + generatePckt: hmiDev,10 + processRtn: hmiDev,10 + startMeasure: hmiDev,10 + startThread: hmiDev,10 + validateSrc: hmiDev,10 + patternname: HMI + HMIAuth: + funcmap: + authenticate: hmiDev,10 + patternname: HMIAuth diff --git a/simulator/input/topo.yaml b/simulator/input/topo.yaml new file mode 100644 index 0000000..795cef6 --- /dev/null +++ b/simulator/input/topo.yaml @@ -0,0 +1,100 @@ +endpts: +- accel: + hmiAccel: AEWIN 0T008 + cores: 1 + groups: [] + interfaces: + - cable: intrfc@hub-hmiDev + carry: [] + device: hmiDev + devname: hmiDev + devtype: Endpt + faces: central + groups: [] + mediatype: wired + name: intrfc@hmiDev-hub + wireless: [] + model: AMD EPYC 9534 64-Core Processor + name: hmiDev +- accel: {} + cores: 1 + groups: [] + interfaces: + - cable: intrfc@hub-embeddedDev + carry: [] + device: embeddedDev + devname: embeddedDev + devtype: Endpt + faces: central + groups: [] + mediatype: wired + name: intrfc@embeddedDev-hub + wireless: [] + model: AMD EPYC 9534 64-Core Processor + name: embeddedDev +- accel: {} + cores: 1 + groups: [] + interfaces: + - cable: intrfc@hub-sslDev + carry: [] + device: sslDev + devname: sslDev + devtype: Endpt + faces: central + groups: [] + mediatype: wired + name: intrfc@sslDev-hub + wireless: [] + model: AMD EPYC 9534 64-Core Processor + name: sslDev +name: exampleName +networks: +- endpts: + - hmiDev + - embeddedDev + - sslDev + groups: [] + mediatype: wired + name: central + netscale: LAN + routers: [] + switches: + - hub +routers: [] +switches: +- groups: [] + interfaces: + - cable: intrfc@hmiDev-hub + carry: [] + device: hub + devname: hub + devtype: Switch + faces: central + groups: [] + mediatype: wired + name: intrfc@hub-hmiDev + wireless: [] + - cable: intrfc@sslDev-hub + carry: [] + device: hub + devname: hub + devtype: Switch + faces: central + groups: [] + mediatype: wired + name: intrfc@hub-sslDev + wireless: [] + - cable: intrfc@embeddedDev-hub + carry: [] + device: hub + devname: hub + devtype: Switch + faces: central + groups: [] + mediatype: wired + name: intrfc@hub-embeddedDev + wireless: [] + model: Netgear GS324T + name: hub + simple: 1 diff --git a/simulator/output/results.yaml b/simulator/output/results.yaml index 06bc057..2879e3a 100644 --- a/simulator/output/results.yaml +++ b/simulator/output/results.yaml @@ -1,4 +1,4 @@ -experiment set run at time 2024-12-14 07:20:35.382921 +experiment set run at time 2024-12-14 07:40:59.906740 - exprmnt: exp-1 measurements: - latency: 1.0840000000007421 (msec) diff --git a/simulator/run.py b/simulator/run.py index 6172e54..d475f8c 100755 --- a/simulator/run.py +++ b/simulator/run.py @@ -186,6 +186,22 @@ def main(): else: simExec = os.path.join(simDir,"sim") + if not os.path.isfile(simExec): + cwd = os.getcwd() + os.chdir(os.path.join(cwd,'sim-dir')) + compileList = ["go","build","sim.go","exp.go"] + process = subprocess.Popen(compileList, + stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) + stdout, stderr = process.communicate() + + if process.returncode != 0: + print("Error building ./sim") + if len(stderr) > 0: + print(stderr) + exit(1) + + os.chdir(cwd) + process = subprocess.Popen([simExec, "-is", simArgs], stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True)