
coding
不是大雄也可以有哆啦a梦
这个作者很懒,什么都没留下…
展开
-
SDN/Mininet/ryu 踩坑
1、Mininet安装不了2.5.0版本ovs可能是ubuntu版本过高(20.04),降低版本后(14.04)成功2、mininet连接远程ryu控制器不成功原先:启动ryu控制器 ryu-manager ryu/ryu/app/simple_switch.py(使用openflow 1.0版本)启动mininet mn --controller=remote,ip=192.168.85.130,port=6653(因为安装的时候选择了openflow 1.3版本,所以没有指定openflow版原创 2021-09-18 16:22:19 · 783 阅读 · 0 评论 -
python高级技巧
1、内置哈希a = ‘hello world’a.hash()2、生成器函数3、子类化内置类以产生增强类class DictSameValueError(ValueError):‘角色名称相同!请修改!’class v_dict(dict):def setitem(self, key, value):if value in self.values():raise DictSameValueError(‘角色名称相同!请修改!’)super().setitem(key, value)n原创 2021-09-18 16:20:00 · 250 阅读 · 0 评论 -
NetDevOps
1、API基于http协议2、HTTP请求方法POST:新建GET:读取PUT:更新PATCH:更新(不常用)DELETE:删除3、Cisco DevNet(github)4、netconf5、napalm-automation网络运维自动化框架原创 2021-09-18 16:19:04 · 343 阅读 · 0 评论 -
Docker网络
1、查看docker配置文件路径systemctl status docker #查看docker运行状态查看Loaded路径 #/lib/systemd/system/docker.service2、重启Docker daemonsystemctl daemon-reloadsystemctl restart docker.service3、flannel重启安装了etcd的机器重启后,需要重新重启etcd服务,需要将flannel网络的配置信息保存到etcdhost机器重启后,需要重启f原创 2021-09-18 15:47:25 · 356 阅读 · 0 评论 -
nornir
1、安装依赖pip install -r requirements.txt2、安装python虚拟环境a、安装虚拟环境pip3 install virtualenvb、安装虚拟环境管理工具pip3 install virtualenvwrapperc、在家目录下创建隐藏目录 .virtualenvs,所有虚拟环境都放在此目录下cd ~mkdir .virtualenvsd、修改家目录下配置文件.bashrcvim ~/.bashrcexport WORKON_HOME=$HOME/.原创 2021-09-18 15:45:16 · 427 阅读 · 0 评论 -
centos7安装python虚拟化环境
centos7安装python虚拟化环境1、安装虚拟环境pip3 install virtualenv2、安装虚拟环境管理工具pip3 install virtualenvwrapper3、在家目录下创建隐藏目录 .virtualenvs,所有虚拟环境都放在此目录下cd ~mkdir .virtualenvs4、修改家目录下配置文件.bashrcvim ~/.bashrcexport WORKON_HOME=$HOME/.virtualenvs #指定创建虚拟环境的目录export V原创 2021-08-24 18:13:40 · 387 阅读 · 0 评论 -
centos7 django项目接入nginx
centos7 django项目接入nginx1、安装uwsigi和配置软连接pip3 install uwsgiln -s /usr/local/python3/bin/uwsgi /usr/bin/uwsgi2、配置uwsgi在项目根目录下创建xml文件vim /root/pycode/switch/switch.xml127.0.0.1:8080/root/pycode/switch/switch.wsgi4 uwsgi.log3、安装nginx(nginx默认安装路径/u原创 2021-08-01 14:52:48 · 162 阅读 · 0 评论 -
centos7 django项目简单部署
centos7 django项目简单部署1、安装django、mysql客户端pip3 install django== 3.1.4python3进入交互模式,引入django模块,成功则安装成功pip3 install pymyql== 1.0.22、创建django项目django-admin startproject mysite报错:-bash: django-admin: command not found原因:find / -name django-admin发现缺少软连接解决原创 2021-07-06 15:21:41 · 526 阅读 · 0 评论 -
python time
python timeimport timetime.localtime() 获取当前结构化时间time.struct_time(tm_year=2021, tm_mon=7, tm_mday=6, tm_hour=12, tm_min=38, tm_sec=29, tm_wday=1, tm_yday=187, tm_isdst=0)backup_time = time.strftime("%Y-%m-%d", time.localtime())2021-07-06backuptime = “原创 2021-07-06 14:00:55 · 138 阅读 · 0 评论 -
Grafana使用教程
Grafana使用教程1、安装grafanawget https://dl.grafana.com/oss/release/grafana-8.0.3-1.x86_64.rpmyum localinstall grafana-8.0.3-1.x86_64.rpmsystemctl start grafana-server.servicesystemctl enable grafana-server.service访问http://10.128.16.25:3000 默认账号密码为admin2、原创 2021-07-01 18:17:34 · 2884 阅读 · 0 评论 -
git学习
git学习1、分布式版本控制系统2、每个版本独立保存3、三棵树:工作区域(平时存放项目的地方)、暂存区域(一个文件,临时存放改动地方)、Git仓库(最终安全存放所有版本的位置,HEAD指针指向最新提交的内容)4、Git管理的文件有三种状态:已修改、已暂存、已提交5、git init 目录初始化空的仓库6、git add 文件将文件存放到暂存区域7、git commit -m ‘add a XX file’将暂存区域文件放到Git仓库8、untracked files:工作区域新增文件(原创 2021-06-17 14:14:37 · 148 阅读 · 0 评论 -
API&&RESTful API
API1、API形式:函数、网址链接2、RESTful:设计风格、设计规范(HTTP就是该架构风格的一个典型应用)3、一般API和RESTful API区别一般API:/api/get_file/ 得到档案/api/upload_file/ 新增档案/api/update/ 更新档案/api/delete_file/ 删除档案RESTful API:/api/file/ GET-得到档案/api/file/ POST-新增档案/api/file/ PUT-更新档案/api/file原创 2021-06-17 14:09:36 · 190 阅读 · 0 评论 -
通过RESTful API获取数据
通过RESTful API获取数据import requestsimport timeimport jsont = time.time()payload = { 'version': '1.0', 'app_key': '402400', 'app_name': 'smokeping', 'operator': 'xxxx', 'method': 'get_allip_info', 'timestamp': t, 'data': {}}原创 2021-06-16 18:27:24 · 928 阅读 · 0 评论 -
单文件实现django
单文件实现djangofrom django.conf import settingsfrom django.http import HttpResponsefrom django.urls import pathfrom django.core.management import execute_from_command_lineimport syssetting = {'DEBUG': True, 'ROOT_URLCONF': __name__}settings.configure(原创 2021-06-16 10:50:09 · 166 阅读 · 0 评论 -
自动化修改smokeping配置ip
修改smokeping配置(通过cmdb接口获取IP)import reimport subprocessimport timelocaltime = time.strftime('%Y-%m-%d', time.localtime())ip = []with open('/usr/local/smokeping/etc/ip.txt') as ipfile: for line in ipfile.readlines(): ip.append(line.strip())原创 2021-06-15 17:33:35 · 275 阅读 · 0 评论