Skip to content

Instantly share code, notes, and snippets.

View sajuptpm's full-sized avatar

Saju Madhavan sajuptpm

View GitHub Profile
git clone myproject
git fetch
git checkout dev_branch
git rebase -i master
:wq <---- save "vim" window which trigger rebase process
If conflict:
* fix conflict
* then run "$git add file_which_has_conflict"
* then run "$git rebase --continue"
* Repeate conflict step and "$git rebase --continue" until we get the message "Successfully rebased and updated"
@sajuptpm
sajuptpm / how-to-download-lynda.md
Created June 26, 2018 09:28 — forked from DonRichards/how-to-download-lynda.md
How to Download Lynda with youtube-dl

How to Download Lynda with youtube-dl with an organization login

Needed:

Cookies Export youtube-dl

  • Install Cookies Export
  • Login to Lynda and navigate to the course you want
  • Cookies export button in browser
  • Copy "cookie.txt" to your desktop
@sajuptpm
sajuptpm / ovsdb.py
Created June 9, 2018 06:50 — forked from ashw7n/ovsdb.py
ovsdb-python-client
import collections
import threading
__author__ = 'ashw7n'
import socket
import json
import logging
logging.basicConfig(level=logging.DEBUG)
@sajuptpm
sajuptpm / ovs-cheat.md
Created May 28, 2018 10:11 — forked from djoreilly/ovs-cheat.md
OVS cheat sheet

DB

ovs-vsctl list interface
ovs-vsctl --columns=ofport,name list Interface
ovs-vsctl --columns=ofport,name --format=table list Interface
ovs-vsctl --format=table --columns=name,mac_in_use find Interface name=br-dpdk1
ovs-vsctl get interface vhub656c3cb-23 name

ovs-vsctl set port vlan1729 tag=1729
ovs-vsctl get port vlan1729 tag
### dhcp example
ovs-appctl ofproto/trace br-int in_port=7,udp,dl_src=fa:16:3e:f4:bd:de,dl_dst=ff:ff:ff:ff:ff:ff,nw_dst=255.255.255.255,udp_dst=67,udp_src=68
Megaflow: recirc_id=0,udp,tun_id=0,in_port=7,dl_src=fa:16:3e:f4:bd:de,dl_dst=ff:ff:ff:ff:ff:ff,nw_ecn=0,nw_frag=no,tp_src=68,tp_dst=67
Datapath actions: tnl_push(tnl_port(2),header(size=50,type=4,eth(dst=52:54:00:9b:2f:62,src=1e:36:0f:9e:1d:41,dl_type=0x0800),ipv4(src=11.0.0.21,dst=11.0.0.26,proto=17,tos=0,ttl=64,frag=0x4000),udp(src=0,dst=4789,csum=0x0),vxlan(flags=0x8000000,vni=0x138a)),out_port(4)),tnl_push(tnl_port(2),header(size=50,type=4,eth(dst=2a:da:01:b8:5f:46,src=1e:36:0f:9e:1d:41,dl_type=0x0800),ipv4(src=11.0.0.21,dst=11.0.0.28,proto=17,tos=0,ttl=64,frag=0x4000),udp(src=0,dst=4789,csum=0x0),vxlan(flags=0x8000000,vni=0x138a)),out_port(4))
###vxlan packet
ovs-appctl ofproto/trace br-int in_port=4,
auto eth4.50
iface eth4.50 inet static
address 0.0.0.0
up ifconfig $IFACE up
down ifconfig $IFACE down
auto vhost0
iface vhost0 inet static
pre-up vif --create vhost0 --mac $(cat /sys/class/net/eth4/address)
pre-up vif --add vhost0 --mac $(cat /sys/class/net/eth4/address) --vrf 0 --mode x --type vhost
import os
import sys
testdir = os.path.dirname(__file__)
topdir = os.path.abspath(os.path.join(testdir, '../../../../../'))
sys.path.insert(0, os.path.join(topdir, 'build/debug/config/api-server/ut-venv/lib/python2.7/site-packages'))
sys.path.append(os.path.join(testdir, '../../utils'))
from provision_bgp import BgpProvisioner
@sajuptpm
sajuptpm / simple-gw-with-internet-access
Created January 30, 2018 22:02 — forked from ajayhn/simple-gw-with-internet-access
Simple gateway from compute using iptables from vgw1 to vhost0 on linux host
This assumes a single net n1 with 1.1.1.0/24 and vgw1 interface. Can be extended to use a public net and vgw1 on the public net
python /opt/contrail/utils/provision_vgw_interface.py --oper create --interface vgw1 --subnets 1.1.1.0/24 --routes 0.0.0.0/0 --vrf default-domain:admin:n1:n1
If you run into error running above script, instead of `import InstanceService` and `import ttypes` use
`from contrail_vrouter_api.gen_py.instance_service import InstanceService, ttypes`
Now do `ifconfig` and verify `vgw1` is present
root@hp-03:/tmp/contrail# lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 16.04.2 LTS
Release: 16.04
Codename: xenial
--------
1. Set hostname and update /etc/hosts
{
"image": [
{
"category": "package",
"id": "contrail_4_0_0_0_20",
"path": "/opt/contrail/contrail-cloud-docker_4.0.0.0-20-newton_xenial.tgz",
"type": "contrail-ubuntu-package",
"version": "4.0.0.0-20"
}
]