Code Monkey home page Code Monkey logo

Comments (12)

iDustbin avatar iDustbin commented on August 28, 2024

curl -X GET "http://localhost:9000/workers/" -H "accept: application/json"

{
"detail": "Could not validate credentials"
}
any idea ?

from netpalm.

tbotnz avatar tbotnz commented on August 28, 2024

@iDustbin check out this postman collection for a list of examples

https://documenter.getpostman.com/view/2391814/T1DqgwcU?version=latest#33acdbb8-b5cd-4b55-bc67-b15c328d6c20

from netpalm.

iDustbin avatar iDustbin commented on August 28, 2024

curl --location --request POST '127.0.0.1:9000/getconfig'
--header 'x-api-key: 2a84465a-cf38-46b2-9d86-b84Q7d57f288'
--header 'Content-Type: application/json'
--data-raw '{
"library": "netmiko",
"connection_args": {
"device_type": "cisco_s300",
"host": "192.168.1.101",
"username": "admin",
"password": "correct_password_included"
},
"command": "show vlan",
"args": {
"use_ttp": true,
"ttp_template": "example"
},
"queue_strategy": "pinned"
}'

response:
{"status":"success","data":{"task_id":"ecd5c12c-3d66-4102-9463-910cab76ab0c","created_on":"2021-09-15 21:33:20.789796","task_queue":"192.168.1.101","task_meta":{"enqueued_at":"2021-09-15 21:33:20.789887","started_at":null,"ended_at":null,"enqueued_elapsed_seconds":"0","total_elapsed_seconds":"0"},"task_status":"queued","task_result":null,"task_errors":[]}}%

curl --location --request GET '127.0.0.1:9000/task/ecd5c12c-3d66-4102-9463-910cab76ab0c'
--header 'x-api-key: 2a84465a-cf38-46b2-9d86-b84Q7d57f288'
--header 'Content-Type: application/json'
--data-raw ''
{"status":"success","data":{"task_id":"ecd5c12c-3d66-4102-9463-910cab76ab0c","created_on":"2021-09-15 21:33:20.789796","task_queue":"192.168.1.101","task_meta":{"enqueued_at":"2021-09-15 21:33:20.789887","started_at":"2021-09-15 21:33:20.808284","ended_at":"2021-09-15 21:33:30.590936","enqueued_elapsed_seconds":"0","total_elapsed_seconds":"9"},"task_status":"finished","task_result":{"show vlan":[[{}]]},"task_errors":[]}}%

another task... can u give me a hint ?
{"status":"success","data":{"task_id":"434e2b64-d37c-4eab-87e5-8dac0fd46a75","created_on":"2021-09-15 21:36:59.847978","task_queue":"192.168.1.101","task_meta":{"enqueued_at":"2021-09-15 21:36:59.848166","started_at":"2021-09-15 21:36:59.866960","ended_at":"2021-09-15 21:37:10.119550","enqueued_elapsed_seconds":"0","total_elapsed_seconds":"10"},"task_status":"finished","task_result":{"show version":[[{}]]},"task_errors":[]}}%

from netpalm.

tbotnz avatar tbotnz commented on August 28, 2024

@iDustbin it appears the TTP parser and or device is not returning anything, based on the above.

from netpalm.

iDustbin avatar iDustbin commented on August 28, 2024

my netmiko output from my own script

Created by: D-Default, S-Static, G-GVRP, R-Radius Assigned VLAN, V-Voice VLAN

Vlan Name Tagged Ports UnTagged Ports Created by


1 1 gi1-10,Po1-8 D
10 10 S
20 20 S
30 30 S
40 40 S
50 50 S
60 60 S

from netpalm.

tbotnz avatar tbotnz commented on August 28, 2024

sure but that is not using TTP?

from netpalm.

tbotnz avatar tbotnz commented on August 28, 2024

curl --location --request POST '127.0.0.1:9000/getconfig'
--header 'x-api-key: 2a84465a-cf38-46b2-9d86-b84Q7d57f288'
--header 'Content-Type: application/json'
--data-raw '{
"library": "netmiko",
"connection_args": {
"device_type": "cisco_s300",
"host": "192.168.1.101",
"username": "admin",
"password": "correct_password_included"
},
"command": "show vlan",
"queue_strategy": "pinned"
}'

from netpalm.

tbotnz avatar tbotnz commented on August 28, 2024

^ try that

from netpalm.

iDustbin avatar iDustbin commented on August 28, 2024

show version output own script:

Active-image: flash://system/images/image_tesla_hybrid_2.5.8.12_release_cisco_signed.bin
Version: 2.5.8.12
MD5 Digest: a71c6b02ba0bf33f4a828ea5527b7aad
Date: 16-Aug-2021
Time: 23:34:46
Inactive-image: flash://system/images/image1.bin
Version: 2.5.0.83
MD5 Digest: 07968d912499cff5e8b07fdc24779854
Date: 18-Jun-2019
Time: 16:49:35
NAME: "1" DESCR: "SG350-10P 10-Port Gigabit PoE Managed Switch"
PID: SG350-10P-K9 VID: V07 SN: PSZ24451C5R

from netpalm.

iDustbin avatar iDustbin commented on August 28, 2024

ok working. thank you :)

-raw ''
{"status":"success","data":{"task_id":"d6796ba4-5d54-4554-a916-224f7f7e8d41","created_on":"2021-09-15 21:44:09.326703","task_queue":"192.168.1.101","task_meta":{"enqueued_at":"2021-09-15 21:44:09.326778","started_at":"2021-09-15 21:44:09.346586","ended_at":"2021-09-15 21:44:19.136246","enqueued_elapsed_seconds":"0","total_elapsed_seconds":"9"},"task_status":"finished","task_result":{"show vlan":["Created by: D-Default, S-Static, G-GVRP, R-Radius Assigned VLAN, V-Voice VLAN","","Vlan Name Tagged Ports UnTagged Ports Created by ","---- ----------------- ------------------ ------------------ ---------------- "," 1 1 gi1-10,Po1-8 D "," 10 10 S "," 20 20 S "," 30 30 S "," 40 40 S "," 50 50 S "," 60 60 S ",""]},"task_errors":[]}}%

from netpalm.

iDustbin avatar iDustbin commented on August 28, 2024

thank you :*

from netpalm.

tbotnz avatar tbotnz commented on August 28, 2024

no worries @iDustbin, I'd recommend looking into textfsm / ttp parsing some more if you are interested in transforming that response to structured data

i've also built this site http://textfsm.nornir.tech/ if you want to develop your own parsing templates

from netpalm.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.