Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

netpalm meet cisco_s300 clients ? & 403 #162

Closed
iDustbin opened this issue Sep 15, 2021 · 12 comments
Closed

netpalm meet cisco_s300 clients ? & 403 #162

iDustbin opened this issue Sep 15, 2021 · 12 comments
Assignees
Labels
invalid This doesn't seem right

Comments

@iDustbin
Copy link

iDustbin commented Sep 15, 2021

hi, could you please include cisco_s300 clients ? and how could i use ssh as netmiko connection ?

@iDustbin
Copy link
Author

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

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

@iDustbin iDustbin changed the title netpalm meet cisco_s300 clients ? netpalm meet cisco_s300 clients ? & 403 Sep 15, 2021
@tbotnz
Copy link
Owner

tbotnz commented Sep 15, 2021

@tbotnz tbotnz self-assigned this Sep 15, 2021
@tbotnz tbotnz added the invalid This doesn't seem right label Sep 15, 2021
@iDustbin
Copy link
Author

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":[]}}%

@tbotnz
Copy link
Owner

tbotnz commented Sep 15, 2021

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

@iDustbin
Copy link
Author

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

@tbotnz
Copy link
Owner

tbotnz commented Sep 15, 2021

sure but that is not using TTP?

@tbotnz
Copy link
Owner

tbotnz commented Sep 15, 2021

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"
}'

@tbotnz
Copy link
Owner

tbotnz commented Sep 15, 2021

^ try that

@iDustbin
Copy link
Author

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

@iDustbin
Copy link
Author

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":[]}}%

@iDustbin
Copy link
Author

thank you :*

@tbotnz
Copy link
Owner

tbotnz commented Sep 15, 2021

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
invalid This doesn't seem right
Projects
None yet
Development

No branches or pull requests

2 participants