Junos Automation (Scripting)
Junos Automation (Scripting)

op script - error: Parameter: $B009 accepts community-name only

a week ago

Hi

 

I recently discovered the service-builder function. It's awesome!

 

I've had some luck settings up interfaces and routing-instances but I can't seem to add a community to a prefix?

 

I've configured the template like this:

 

set groups BETA-template-group policy-options prefix-list BETA_Srv_Mgt 10.7.7.0/24
set groups BETA-template-group policy-options prefix-list BETA_Srv 10.4.4.0/24
set groups BETA-template-group policy-options policy-statement Export1 term BETA from prefix-list BETA_Srv
set groups BETA-template-group policy-options policy-statement Export1 term BETA then community add BETA
set groups BETA-template-group policy-options policy-statement Export1 term BETA then accept
set groups BETA-template-group policy-options policy-statement Export1 term BETAMGT from prefix-list BETA_Srv_Mgt
set groups BETA-template-group policy-options policy-statement Export1 term BETAMGT then community add BETAMGT
set groups BETA-template-group policy-options policy-statement Export1 term BETAMGT then accept
set groups BETA-template-group policy-options community BETA members 65001:114
set groups BETA-template-group policy-options community BETAMGT members 65001:117

I set up the parameters like this:

 

Please enter multiple selections separated by a comma (,) only.
-----------------------------------
Enter Selection:> [default:all] 
Enter parameter name for: 1.policy-options/prefix-list/name
*************************
[ edit groups BETA-template-group policy-options ] 
Name for this parameter? B001
Do you want to revise 'B001'? (yes/no)[no]: 
Enter parameter name for: 2.policy-options/prefix-list/prefix-list-item/name
*************************
[ edit groups BETA-template-group policy-options ] 
Name for this parameter? B002
Do you want to revise 'B002'? (yes/no)[no]: 
Enter parameter name for: 3.policy-options/prefix-list/name
*************************
[ edit groups BETA-template-group policy-options ] 
Name for this parameter? B003
Do you want to revise 'B003'? (yes/no)[no]: 
Enter parameter name for: 4.policy-options/prefix-list/prefix-list-item/name
*************************
[ edit groups BETA-template-group policy-options ] 
Name for this parameter? B004
Do you want to revise 'B004'? (yes/no)[no]: 
Enter parameter name for: 5.policy-options/policy-statement/name
*************************
[ edit groups BETA-template-group policy-options ] 
Name for this parameter? B005
Do you want to revise 'B005'? (yes/no)[no]: 
Enter parameter name for: 6.policy-options/policy-statement/term/name
*************************
[ edit groups BETA-template-group policy-options ] 
Name for this parameter? B006
Do you want to revise 'B006'? (yes/no)[no]: 
Enter parameter name for: 7.policy-options/policy-statement/term/from/prefix-list/name
*************************
[ edit groups BETA-template-group policy-options ] 
Name for this parameter? B007
Do you want to revise 'B007'? (yes/no)[no]: 
Enter parameter name for: 8.policy-options/policy-statement/term/then/community/add
*************************
[ edit groups BETA-template-group policy-options ] 
Name for this parameter? B008
Do you want to revise 'B008'? (yes/no)[no]: 
Enter parameter name for: 9.policy-options/policy-statement/term/then/community/community-name
*************************
[ edit groups BETA-template-group policy-options ] 
Name for this parameter? B009
Do you want to revise 'B009'? (yes/no)[no]: 
Enter parameter name for: 10.policy-options/policy-statement/term/then/accept
*************************
[ edit groups BETA-template-group policy-options ] 
Name for this parameter? B010
Do you want to revise 'B010'? (yes/no)[no]: 
Enter parameter name for: 11.policy-options/policy-statement/term/name
*************************
[ edit groups BETA-template-group policy-options ] 
Name for this parameter? B011
Do you want to revise 'B011'? (yes/no)[no]: 
Enter parameter name for: 12.policy-options/policy-statement/term/from/prefix-list/name
*************************
[ edit groups BETA-template-group policy-options ] 
Name for this parameter? B012
Do you want to revise 'B012'? (yes/no)[no]: 
Enter parameter name for: 13.policy-options/policy-statement/term/then/community/add
*************************
[ edit groups BETA-template-group policy-options ] 
Name for this parameter? B013
Do you want to revise 'B013'? (yes/no)[no]: 
Enter parameter name for: 14.policy-options/policy-statement/term/then/community/community-name
*************************
[ edit groups BETA-template-group policy-options ] 
Name for this parameter? B014
Do you want to revise 'B014'? (yes/no)[no]: 
Enter parameter name for: 15.policy-options/policy-statement/term/then/accept
*************************
[ edit groups BETA-template-group policy-options ] 
Name for this parameter? B015
Do you want to revise 'B015'? (yes/no)[no]: 
Enter parameter name for: 16.policy-options/community/name
*************************
[ edit groups BETA-template-group policy-options ] 
Name for this parameter? B016
Do you want to revise 'B016'? (yes/no)[no]: 
Enter parameter name for: 17.policy-options/community/members
*************************
[ edit groups BETA-template-group policy-options ] 
Name for this parameter? B017
Do you want to revise 'B017'? (yes/no)[no]: 
Enter parameter name for: 18.policy-options/community/name
*************************
[ edit groups BETA-template-group policy-options ] 
Name for this parameter? B018
Do you want to revise 'B018'? (yes/no)[no]: 
Enter parameter name for: 19.policy-options/community/members
*************************
[ edit groups BETA-template-group policy-options ] 
Name for this parameter? B019
Do you want to revise 'B019'? (yes/no)[no]: 
Do you want to commit the previously selected options to create BETA script?  (yes/no)[yes]: 
Created service script: /config/scripts/op/BETA.slax
-

 

No matter  which way I pose the arguments, I always meet some sort of error:

 

op BETA service-id BETA action create B001 BETA_Srv_Mgt B002 10.7.7.0/24 B003 BETA_Srv B004 10.4.4.0/24 B005 Export1 B006 BETA B007 BETA_Srv B008 add B009 community-name B010 accept B011 BETAMGT B012 BETA_Srv_Mgt B013 add B014 community-name B015 accept B016 BETA B017 65001:114 B018 BETAMGT B019 65001:117 detail


root@vSRX_00> ... B017 65001:114 B018 BETAMGT B019 65001:117 detail          
2020-01-13 17:08:12 UTC: reading op script input details
2020-01-13 17:08:12 UTC: testing op details
2020-01-13 17:08:12 UTC: running op script 'BETA.slax'
2020-01-13 17:08:12 UTC: opening op script '/config/scripts/op/BETA.slax'
2020-01-13 17:08:12 UTC: reading op script 'BETA.slax'
2020-01-13 17:08:12 UTC: inspecting op output 'BETA.slax'
Policy error: community-name community referenced (in term BETA) but not defined
configuration check-out failed
2020-01-13 17:08:12 UTC: finished op script 'BETA.slax'

Another example:

 

op BETA service-id BETA action create B001 BETA_Srv_Mgt B002 10.7.7.0/24 B003 BETA_Srv B004 10.4.4.0/24 B005 Export1 B006 BETA B007 BETA_Srv B008 add B009 BETA B010 accept B011 BETAMGT B012 BETA_Srv_Mgt B013 add B014 BETAMGT B015 accept B016 BETA B017 65001:114 B018 BETAMGT B019 65001:117

root@vSRX_00> ...ETA B017 65001:114 B018 BETAMGT B019 65001:117 detail       
2020-01-13 17:11:40 UTC: reading op script input details
2020-01-13 17:11:40 UTC: testing op details
2020-01-13 17:11:40 UTC: running op script 'BETA.slax'
2020-01-13 17:11:40 UTC: opening op script '/config/scripts/op/BETA.slax'
2020-01-13 17:11:40 UTC: reading op script 'BETA.slax'
error: Parameter: $B009 accepts community-name only
error: Parameter: $B014 accepts community-name only
2020-01-13 17:11:41 UTC: inspecting op output 'BETA.slax'
syntax error, expecting <choice-ident>
statement creation failed
2020-01-13 17:11:41 UTC: finished op script 'BETA.slax'

I would love to get this working, thanks.

 

 

-
https://www.msbnet.co.uk