{"id":1090,"date":"2017-03-27T11:13:44","date_gmt":"2017-03-27T16:13:44","guid":{"rendered":"http:\/\/blog.ls-al.com\/?p=1090"},"modified":"2020-07-10T15:47:02","modified_gmt":"2020-07-10T20:47:02","slug":"solaris-dlmp-test-vlan","status":"publish","type":"post","link":"https:\/\/blog.ls-al.com\/solaris-dlmp-test-vlan\/","title":{"rendered":"Solaris DLMP Test VLAN"},"content":{"rendered":"
As usual use at own risk! <\/p>\n
This may not apply to many people but I have an instance where we use DLMP which I really like. However one weakness I have in my environment if someone screw up a VLAN port configuration on a switch you may have serious networking issues and not understand what is happening. DLMP is not going to disable a port in an aggregation because there is link and it does not know if VLAN's are set or not. So I wrote a quick script I may play with more later to improve but this already helps with speeding up testing. Time is something you may not have a lot of when you have intermittent and very odd network behavior.<\/p>\n
And of course you will need to take these ports you want to test out of the aggregation for testing and add back in if you need to.<\/p>\n
Let me know if anyone find a better way for example DLMP built-in test or testing at a lower level in the networking model etc.<\/p>\n
# cat check_vlans.py \n#!\/usr\/bin\/python\nimport subprocess,re,sys\n\nvlans={}\nvlans[1915] = {'IP': '10.2.12.230\/24', 'name': 'DR'}\nvlans[1953] = {'IP': '10.2.13.230\/24', 'name': 'PPE'}\nvlans[1954] = {'IP': '10.2.16.230\/23', 'name': 'TST'}\nvlans[1912] = {'IP': '10.2.14.230\/23', 'name': 'DEV'}\nvlans[1913] = {'IP': '10.2.10.230\/24', 'name': 'MGMT'}\n\ndef get_aggr_nets():\n ls_lines = subprocess.Popen(['dladm', 'show-link','xgaggr1'], stdout=subprocess.PIPE).communicate()[0].splitlines()\n line = re.sub(' +',' ',ls_lines[1])\n props = line.split(' ')\n print \"LINK: {} CLASS: {} MTU: {} STATE: {} NETS: \".format(props[0],props[1],props[2],props[3]),\n print props[4:]\n\ndef vlan_test(nets):\n for net in nets:\n result = subprocess.Popen(['dladm', 'create-vlan','-l',str(net),'-v','1912','vlan1'], stdout=subprocess.PIPE).communicate()[0].splitlines()\n\n for i,v in vlans.iteritems() :\n print \"Testing interface: {} over vlan id: {} {} using IP: {} Result: \".format(net,i,v['name'],v['IP']),\n\n result = subprocess.Popen(['dladm', 'modify-vlan','-v',str(i),'vlan1'], stdout=subprocess.PIPE).communicate()[0].splitlines()\n\n result = subprocess.Popen(['ipadm', 'create-ip','vlan1'], stdout=subprocess.PIPE).communicate()[0].splitlines()\n\n result = subprocess.Popen(['ipadm', 'create-addr','-T','static','-a',v['IP'],'vlan1\/v4'], stdout=subprocess.PIPE).communicate()[0].splitlines()\n\n subnet=v['IP'].split('.')\n gateway='10.2.' + str(subnet[2]) + '.1'\n\n #result = subprocess.Popen(['ping', '-i','vlan1',gateway], stdout=subprocess.PIPE).communicate()[0].splitlines()\n result = subprocess.Popen(['ping', '-i','vlan1',gateway,'57','1'], stdout=subprocess.PIPE).communicate()[0].splitlines()\n print result\n\n result = subprocess.Popen(['ipadm', 'delete-ip','vlan1'], stdout=subprocess.PIPE).communicate()[0].splitlines()\n\n result = subprocess.Popen(['dladm', 'delete-vlan','vlan1'], stdout=subprocess.PIPE).communicate()[0].splitlines()\n\nprint \"\\n\\nShow nets in xgaggr1:\"\nget_aggr_nets()\nprint \"\\n\\nTesting net: \" + sys.argv[1]\ntest_nets = [sys.argv[1]]\nprint test_nets\nvlan_test(test_nets)<\/code><\/pre>\nExample run.<\/p>\n
root@usli-psvm-ld01 # python check_vlans.py net3\n\nShow nets in xgaggr1:\nLINK: xgaggr1 CLASS: aggr MTU: 1500 STATE: up NETS: ['net1']\n\nTesting net: net3\n['net3']\nTesting interface: net3 over vlan id: 1912 DEV using IP: 10.2.14.230\/23 Result: ['no answer from 10.2.14.1']\nTesting interface: net3 over vlan id: 1953 PPE using IP: 10.2.13.230\/24 Result: ['no answer from 10.2.13.1']\nTesting interface: net3 over vlan id: 1954 TST using IP: 10.2.16.230\/23 Result: ['no answer from 10.2.16.1']\nTesting interface: net3 over vlan id: 1915 DR using IP: 10.2.12.230\/24 Result: ['no answer from 10.2.12.1']\nTesting interface: net3 over vlan id: 1913 MGMT using IP: 10.2.10.230\/24 Result: ['no answer from 10.2.10.1']<\/code><\/pre>\nroot@usli-psvm-ld01 # python check_vlans.py net0\n\nShow nets in xgaggr1:\nLINK: xgaggr1 CLASS: aggr MTU: 1500 STATE: up NETS: ['net1']\n\nTesting net: net0\n['net0']\nTesting interface: net0 over vlan id: 1912 DEV using IP: 10.2.14.230\/23 Result: ['10.2.14.1 is alive']\nTesting interface: net0 over vlan id: 1953 PPE using IP: 10.2.13.230\/24 Result: ['10.2.13.1 is alive']\nTesting interface: net0 over vlan id: 1954 TST using IP: 10.2.16.230\/23 Result: ['10.2.16.1 is alive']\nTesting interface: net0 over vlan id: 1915 DR using IP: 10.2.12.230\/24 Result: ['10.2.12.1 is alive']\nTesting interface: net0 over vlan id: 1913 MGMT using IP: 10.2.10.230\/24 Result: ['10.2.10.1 is alive']<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"As usual use at own risk! This may not apply to many people but I have an instance where we<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[14],"tags":[],"class_list":["post-1090","post","type-post","status-publish","format-standard","hentry","category-solaris"],"_links":{"self":[{"href":"https:\/\/blog.ls-al.com\/wp-json\/wp\/v2\/posts\/1090","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.ls-al.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.ls-al.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.ls-al.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.ls-al.com\/wp-json\/wp\/v2\/comments?post=1090"}],"version-history":[{"count":0,"href":"https:\/\/blog.ls-al.com\/wp-json\/wp\/v2\/posts\/1090\/revisions"}],"wp:attachment":[{"href":"https:\/\/blog.ls-al.com\/wp-json\/wp\/v2\/media?parent=1090"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.ls-al.com\/wp-json\/wp\/v2\/categories?post=1090"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.ls-al.com\/wp-json\/wp\/v2\/tags?post=1090"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}