Skip to content

Commit eeb21e4

Browse files
author
David Linko
committed
fixed up creating execset
1 parent 3d527e2 commit eeb21e4

File tree

13 files changed

+63
-28
lines changed

13 files changed

+63
-28
lines changed

anms-core/anms/routes/ARIs/reports.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -81,12 +81,10 @@ async def report_def_by_id(agent_id: str):
8181
if(res):
8282
ari_val = await transcoder.transcoder_put_cbor_await("ari:0x"+res.entries.hex())
8383
ari_val = ari_val['data']
84-
85-
86-
addition = {'exec_set': ari_val,'correlator_nonce':correlator_nonce}
87-
84+
addition = {'exec_set': ari_val,'correlator_nonce':correlator_nonce}
8885
if addition not in final_res:
8986
final_res.append(addition)
87+
9088
return final_res
9189

9290

anms-core/anms/routes/network_manager.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,11 @@ async def nm_register_agent(addr: Data):
7373
url = nm_url + "/agents"
7474
logger.info('POST to nm manager %s with addr %s' % (url, addr.data))
7575
try:
76-
request = requests.post(url=url, data="'"+addr.data+"'", headers={'Content-Type: text/plain'} )
77-
except Exception:
76+
request = requests.post(url=url, data=addr.data, headers={'Content-Type': 'text/plain'} )
77+
except Exception as e:
78+
logger.info(e)
7879
return status.HTTP_500_INTERNAL_SERVER_ERROR
80+
7981
return request.status_code
8082

8183

anms-core/anms/routes/transcoder.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,10 +104,17 @@ async def transcoder_put_cbor_await(cbor: str):
104104
MQTT_CLIENT.publish("transcode/CoreFacing/Outgoing", msg)
105105
else:
106106
transcoder_log_id = curr_uri.transcoder_log_id
107+
if curr_uri.parsed_as != "pending":
108+
if curr_uri.parsed_as == "ERROR":
109+
curr_uri = "ARI://BADARI"
110+
else:
111+
curr_uri = curr_uri.uri
112+
return {"data": curr_uri}
113+
107114

108115
while True:
109116
with get_session() as session:
110-
curr_uri = TranscoderLog.query.filter_by(transcoder_log_id=transcoder_log_id).first()
117+
curr_uri = TranscoderLog.query.filter_by(TranscoderLog.transcoder_log_id==transcoder_log_id).first()
111118
if curr_uri.parsed_as == "CBOR":
112119
curr_uri = curr_uri.uri
113120
break

anms-ui/public/app/components/management/agents/Agents.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@
9696
:cbor="cbor"></agents-manage-modal>
9797

9898
<footer class="footer">
99-
<p><a :href="info.split(' - ')[1]" target="_blank">Amp Version: {{ info.split(" - ")[0] }}</a></p>
99+
<p><a>Amp Version: {{ info }}</a></p>
100100
</footer>
101101
</div>
102102
</template>
@@ -157,8 +157,8 @@ export default {
157157
api.methods
158158
.apiAmpVersion()
159159
.then((response) => {
160-
if(response.data.amp_version_str != null){
161-
vm.info = response.data.amp_version_str;
160+
if(response.data.build_date != null){
161+
vm.info = response.data.build_date + " " + response.data.build_time;
162162
}
163163
})
164164
.catch(function (error) {

anms-ui/public/app/components/management/agents/AgentsManageModal.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
</b-button>
3535
</b-col>
3636
<b-col cols="9">
37-
<build :cbor="cbor" :agentModal=true @updateResult="updateResults($event)"></build>
37+
<build :cbor="cbor" @updateResult="updateResults($event)"></build>
3838
</b-col>
3939
</b-row>
4040
</div>
@@ -44,7 +44,7 @@
4444
<script>
4545
import api from "../../../shared/api.js";
4646
import Build from "../builder/Build.vue";
47-
import toastr from "toastr"
47+
import toastr from "toastr";
4848
export default {
4949
name: "AgentsManageModal",
5050
components: { Build },

anms-ui/public/app/components/management/agents/reports.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
value="-1">-- Select Sent Reports --</b-form-select-option>
1717
<b-form-select-option v-for="rpt, index in rptts"
1818
:key="index"
19-
:value="index">{{ rpt }}</b-form-select-option>
19+
:value="index">{{ decodeURI(rpt) }}</b-form-select-option>
2020
</b-form-select>
2121
<b-table sticky-header
2222
hover

anms-ui/public/app/components/management/builder/ActionParameter.vue

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,14 +66,14 @@ export default {
6666
this.addToList();
6767
},
6868
addToList: function () {
69+
if(this.ac.length >= this.count){
70+
this.ac.pop();
71+
}
6972
7073
if (this.ariKey != null) {
7174
this.ac.push(this.ariKey)
7275
}
73-
74-
if(this.ac.length > this.count){
75-
this.ac.pop();
76-
}
76+
7777
this.ariKey = null;
7878
this.createAC();
7979
},

anms-ui/public/app/components/management/builder/Build.vue

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,19 @@
2121
</template>
2222
</div>
2323
<template v-if="!stringMode">
24+
<label>
25+
<input type="checkbox" v-model="isExecutionCheck"/>
26+
Execution Set?
27+
</label>
28+
<div v-if="isExecutionCheck">
29+
<!-- <label>correlator_nonce:</label> -->
30+
<b-form-input
31+
size="sm"
32+
v-model="correlator_nonce"
33+
@change="updateResults"/>
34+
</div>
2435
<v-select v-model="ariKey" label="display" :options="ARIs" ></v-select>
25-
<ParameterView v-if="ariKey" :ariKey="ariKey" :ACs="ARIs" :agentModal="agentModal" @updateResult="updateResults($event)"></ParameterView>
36+
<ParameterView v-if="ariKey" :ariKey="ariKey" :ACs="ARIs" :nonce="correlator_nonce" @updateResult="updateResults($event)"></ParameterView>
2637
</template>
2738
</div>
2839
</div>
@@ -55,6 +66,8 @@ export default {
5566
finResultStr: undefined,
5667
stringMode: false,
5768
cborString: "",
69+
correlator_nonce: undefined,
70+
isExecutionCheck: false,
5871
}
5972
},
6073
mounted(){

anms-ui/public/app/components/management/builder/ParameterView.vue

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ export default {
6868
components: {
6969
vSelect,
7070
},
71-
props: ["ariKey", "ACs", "agentModal"],
71+
props: ["ariKey", "ACs", "nonce"],
7272
data() {
7373
return {
7474
parameters: [],
@@ -116,7 +116,6 @@ export default {
116116
this.submitCommand();
117117
},
118118
submitCommand() {
119-
120119
let testResult = [];
121120
if (this.ariKey.actual) {
122121
this.$emit("updateResult", [{ type: "/ARITYPE/OBJECT", value: this.ariKey.display }]);
@@ -214,11 +213,11 @@ export default {
214213
testResult +
215214
")";
216215
// if using in agentModal adding ari:/EXECSET/ portion
217-
if(this.agentModal){
218-
// correlator_nonce
216+
if(typeof this.nonce !== 'undefined'){
217+
// correlator_nonc
219218
// TODO currently random mayube make it increment or a choice
220-
let nonce = Math.floor(Math.random() * 99999) + 1;
221-
this.finResultStr = "ari:/EXECSET/n=" + nonce + ";(" + this.finResultStr +")";
219+
// let nonce = Math.floor(Math.random() * 99999) + 1;
220+
this.finResultStr = "ari:/EXECSET/n=" + this.nonce + ";(" + this.finResultStr +")";
222221
}
223222
this.$emit("updateResult", [{ type: "ARI", value: this.finResultStr }]);
224223
this.finResult = this.finResultBase;

anms-ui/public/app/components/management/builder/buildAri.vue

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,24 @@
3333

3434
<b-container>
3535
<h5>ARI Builder</h5>
36+
<label>
37+
<input type="checkbox" v-model="isExecutionCheck" onchange="updateNonce"/>
38+
Execution Set?
39+
</label>
40+
<div v-if="isExecutionCheck">
41+
<label>correlator_nonce:</label>
42+
<b-form-input
43+
size="sm"
44+
v-model="correlator_nonce"
45+
@change="updateResults"/>
46+
</div>
3647
<v-select v-model="ariKey"
3748
label="display"
3849
:options="ARIs"></v-select>
39-
4050
<ParameterView v-if="ariKey"
4151
:ariKey="ariKey"
4252
:ACs="ARIs"
53+
:nonce="correlator_nonce"
4354
@updateResult="updateResults($event)"></ParameterView>
4455

4556
<div v-if="ariKey" class="text-center my-3">
@@ -98,6 +109,8 @@ export default {
98109
cborString: "",
99110
checkbox: false,
100111
stringMode: false,
112+
correlator_nonce: undefined,
113+
isExecutionCheck: false,
101114
};
102115
},
103116
computed: {
@@ -123,6 +136,9 @@ export default {
123136
reloadARIs: "reloadARIs",
124137
setSearchString: "setSearchString"
125138
}),
139+
updateNonce(){
140+
this.correlator_nonce = undefined;
141+
},
126142
onSearch(search, loading) {
127143
if (search.length) {
128144
loading(true);

0 commit comments

Comments
 (0)