Hi Peter,
Nice. I have added yet some more improvements.
Your initial version had the option to select the vswitch, I added that in this
one as well. I also added the VLAN configuration for the guests. Next, we have
guests in TRUNK mode, with multiple IP addresses. With pick count 1 you don't
get all of them so I updated the pick statement to use the FROM - TO sequence.
Now a guest is listed with each assigned IP address.
The output would now be like:
<guest1> <IP address> <vlan(s)>
<guest1> <another IP address> <vlan(s)>
<guest2> <IP address> <vlan>
Etc.
parse upper arg vsw .
If vsw = "" then
SAY "Listing home addresses for all VSWITCH clients"
Else
SAY "Listing home addresses for VSWITCH "vsw" clients"
ADDRESS COMMAND /* requires PIPE to be capitalised */
'PIPE (end ?) cp q vswitch 'vsw' det', /* display the VSWITCH */
'|strip ', /* Remove spaces */
'|a: find VSWITCH', /* find the switch name*/
'|spec w2-3 1', /* name is words 2 & 3 */
'|insert /Switch: /', /* insert prefix */
'|console', /* show collected input*/
'?a:', /* look for clients */
'|l: locate /Adapter Owner:/', /* find the client */
'|spec w3 1', /* save their name */
'|f:juxtapose ', /* get IP VLAN */
'|spec w1 1.8 w3 11.16 w2 nw', /* format */
'|console', /* show collected input*/
'?l:', /* find home address */
'|v: locate w1 /VLAN:/', /* VLAN data */
'|nlocate w2 /IPv6/', /* Only IPv4 VLAN */
'|change w4-* /Assigned by system//', /* Drop assigned */
'|change w3-* / /,/ ', /* all VLAN one word */
'|spec w3 2', /* save VLANs */
'|g: juxtapose ', /* add IP */
'|f:', /* go and show it */
'?v:', /* find home address */
'|pick from after word 1 == "Unicast" ', /* Unicast addresses */
' to word 1 == "Multicast" ', /* Unicast addresses */
'|spec w1 3', /* save home addresses */
'|nlocate /:/ ', /* Drop IPv6 */
'|g:' /* go and show it */
BTW, should you want to list IPv6 instead of IPv4, replace the nlocate IPv6
with locate and adjust the formatting spec to w3 11.40.
BTW2, if you want to run it with the old PIPELINES, then replace the PICK with
INSIDE:
'|inside /Unicast/ /Multicast/ ', /* Unicast addresses */
Met vriendelijke groet/With kind regards/Mit freundlichen Grüßen,
Berry van Sleeuwen
Flight Forum 3000 5657 EW Eindhoven
-----Original Message-----
From: CMSTSO Pipelines Discussion List <[email protected]> On Behalf
Of Bishop, Peter
Sent: Friday, March 15, 2019 4:39 AM
To: [email protected]
Subject: Re: [CMS-PIPELINES] v6.4 filter for VSWITCH output
Replying to myself, I know, bad form...
Anyway, here's my improved version which parses Q VSWITCH DET
SAY "Listing home addresses for all VSWITCH clients";say
ADDRESS COMMAND /* requires PIPE to be capitalised */
'PIPE (end ?) cp q vswitch det', /* display the VSWITCH */
'|a: find VSWITCH', /* find the switch name*/
'|spec w2-3 1', /* name is words 2 & 3 */
'|insert /Switch: /', /* insert prefix */
'|console', /* show collected input*/
'?a:', /* look for clients */
'|l: locate /Adapter Owner:/', /* find the client */
'|spec w3 1', /* save their name */
'|pad 12', /* pad it with blanks */
'|f:faninany', /* get other input */
'|join', /* join into table form*/
'|console', /* show collected input*/
'?l:', /* find home address */
'|pick from after word 1 == "Unicast" count 1', /* after Unicast*/
'|spec w1 1', /* save home address */
'|f:' /* go and show it */
Output on my system edited for privacy but you get the idea:
vsho
Listing home addresses for all VSWITCH clients
Switch: SYSTEM name-changed-for-privacy-1
Swi1Host1 Add1-changed-for-privacy
Swi1Host2 Add2-changed-for-privacy
Swi1Host3 Add3-changed-for-privacy
Swi1Host4 Add4-changed-for-privacy
Switch: SYSTEM name-changed-for-privacy-2
Swi2Host1 Add1-changed-for-privacy
Swi2Host2 Add2-changed-for-privacy
Swi2Host3 Add3-changed-for-privacy
Swi2Host4 Add4-changed-for-privacy
Ready;
Pipes are very neat and I would love to have them on my TSO systems but am not
holding my breath...
Kind regards,
Peter Bishop
System Programmer - Mainframe
From: Bishop, Peter
Sent: Friday, March 15, 2019 09:40
To: CMSTSO Pipelines Discussion List <[email protected]>
Subject: v6.4 filter for VSWITCH output
Hi,
Thought I'd offer this up just for fun. I made it for a simple view of Q
VSWITCH xx DET, showing just the home addresses of the connected guests,
instead of wading through screens of output...
/*-----------------------------------------------------------*/
/* show the home address of each connected VSWITCH client */
/*-----------------------------------------------------------*/
ARG sw . /* show the home addresses of this switch */
IF sw = '' THEN EXIT
SIGNAL ON NOVALUE
SAY "Listing home addresses for "sw ;SAY
ADDRESS COMMAND /* requires PIPE to be capitalised */
'PIPE (end ?) cp q vswitch' sw 'det' , /* display the VSWITCH */
'|l: locate /Adapter Owner:/', /* find the client */
'|spec w3 1', /* save their name */
'|f:faninany', /* get other input */
'|pad 20', /* make it readable */
'|snake 4', /* four columns wide */
'|console', /* show collected input*/
'?l: |pick from after word 1 == "Unicast" count 1',/* find home*/
'|spec w1 1', /* save home address */
'|f:' /* go and show it */
It gives this output on my 6.4 system, names etc. changed to protect the
innocent. Not backward-compatible to v6.3, where it fails on 'pick from' which
is a very nice improvement.
xsho vswitchname
Listing home addresses for vswitchname
Host1 Host2 Host3 Host4
IpAddr1 IpAddr2 IpAddr3 IpAddr4
Ready;
Now I'm off to improve it so that it will list them for all defined VSWITCHes
instead of requiring the name as input, and maybe tabulate the output
differently.
It's quite nice how easy it is to toy around with pipes until you have
something worth saving...lots of stumbles along the way but experience is the
best teacher...
Kind regards,
Peter Bishop
System Programmer - Mainframe
DXC Technology Australia Pty Limited; Registered Office: 26 Talavera Road,
Macquarie Park NSW 2113 Australia; Incorporated in Australia ACN: 008 476 944.
DXC Technology Company -- This message is transmitted to you by or on behalf of
DXC Technology Company or one of its affiliates. It is intended exclusively for
the addressee. The substance of this message, along with any attachments, may
contain proprietary, confidential or privileged information or information that
is otherwise legally exempt from disclosure. Any unauthorized review, use,
disclosure or distribution is prohibited. If you are not the intended recipient
of this message, you are not authorized to read, print, retain, copy or
disseminate any part of this message. If you have received this message in
error, please destroy and delete all copies and notify the sender by return
e-mail. Regardless of content, this e-mail shall not operate to bind DXC
Technology Company or any of its affiliates to any order or other contract
unless pursuant to explicit written agreement or government initiative
expressly permitting the use of e-mail for such purpose.
This e-mail and the documents attached are confidential and intended solely for
the addressee; it may also be privileged. If you receive this e-mail in error,
please notify the sender immediately and destroy it. As its integrity cannot be
secured on the Internet, Atos’ liability cannot be triggered for the message
content. Although the sender endeavours to maintain a computer virus-free
network, the sender does not warrant that this transmission is virus-free and
will not be liable for any damages resulting from any virus transmitted. On all
offers and agreements under which Atos Nederland B.V. supplies goods and/or
services of whatever nature, the Terms of Delivery from Atos Nederland B.V.
exclusively apply. The Terms of Delivery shall be promptly submitted to you on
your request.