# With custom commit message./push.sh "Added new feature"# Interactive (prompts for message)./push.sh# Auto-generated message./push.sh # (if no message, uses timestamp)
Complete Script
#!/bin/bash# ============================================================================# Script de Push Rápido - Nokia BNG Lab# ============================================================================# Uso: ./push.sh "mensaje del commit"# ============================================================================set -e# ColoresRED='\033[0;31m'GREEN='\033[0;32m'YELLOW='\033[1;33m'BLUE='\033[0;34m'CYAN='\033[0;36m'NC='\033[0m'print_step() { echo -e "${BLUE}[*]${NC} $1"; }print_success() { echo -e "${GREEN}[✓]${NC} $1"; }print_error() { echo -e "${RED}[✗]${NC} $1"; }print_warning() { echo -e "${YELLOW}[!]${NC} $1"; }# Banner compactoecho ""echo -e "${BLUE}╔══════════════════════════════════════════════════════════════╗${NC}"echo -e "${BLUE}║${NC} ${CYAN}Nokia BNG Lab - Push de Cambios${NC} ${BLUE}║${NC}"echo -e "${BLUE}╚══════════════════════════════════════════════════════════════╝${NC}"echo ""# Verificaciones básicasif [ ! -f "mkdocs.yml" ] || [ ! -f "lab.yml" ]; then print_error "Este script debe ejecutarse desde el directorio del laboratorio" exit 1fiif [ ! -d ".git" ]; then print_error "No es un repositorio Git. Ejecuta primero: ./deploy-github.sh" exit 1fi# Verificar si hay cambiosif git diff --quiet && git diff --staged --quiet; then print_warning "No hay cambios pendientes para subir" echo "" echo " Últimos commits:" git log --oneline -5 echo "" exit 0fi# Mostrar resumen de cambiosprint_step "Resumen de cambios:"echo ""echo -e "${CYAN}Archivos modificados:${NC}"git status --short | head -20CHANGES_COUNT=$(git status --short | wc -l)if [ "$CHANGES_COUNT" -gt 20 ]; then echo " ... y $(($CHANGES_COUNT - 20)) archivos más"fiecho ""# Obtener mensaje de commitif [ -n "$1" ]; then COMMIT_MSG="$*"else echo -e "${CYAN}Tipos de commit sugeridos:${NC}" echo " feat: Nueva funcionalidad" echo " fix: Corrección de bug" echo " docs: Cambios en documentación" echo " config: Cambios en configuración" echo " refactor: Refactorización de código" echo "" read -p "Mensaje del commit: " COMMIT_MSG if [ -z "$COMMIT_MSG" ]; then COMMIT_MSG="update: $(date '+%Y-%m-%d %H:%M')" fifi# Agregar archivos (excluyendo licencias)print_step "Agregando archivos..."git add .# Remover licencias si se agregaron accidentalmentegit reset -- configs/license/ 2>/dev/null || truegit reset -- license/ 2>/dev/null || truegit reset -- '*.lic' 2>/dev/null || trueprint_success "Archivos agregados"# Crear commitprint_step "Creando commit..."git commit -m "$COMMIT_MSG"print_success "Commit creado: $COMMIT_MSG"# Pushprint_step "Subiendo a GitHub..."git push origin mainecho ""echo -e "${GREEN}════════════════════════════════════════════════════════════════${NC}"echo -e "${GREEN}[✓] ¡Cambios subidos exitosamente!${NC}"echo -e "${GREEN}════════════════════════════════════════════════════════════════${NC}"echo ""
cd ~/workspace/source/configs/scripts./verify-pd.sh
Complete Script
#!/bin/bash# Script de verificación de DHCPv6 con Prefix Delegationecho "=============================================="echo "Verificación de DHCPv6 con Prefix Delegation"echo "=============================================="echo ""# ColoresRED='\033[0;31m'GREEN='\033[0;32m'YELLOW='\033[1;33m'NC='\033[0m' # No Colorcheck_pass() { echo -e "${GREEN}[✓] $1${NC}"}check_fail() { echo -e "${RED}[✗] $1${NC}"}check_warn() { echo -e "${YELLOW}[!] $1${NC}"}# ============================================# Verificar en ONT1# ============================================echo "--- Verificando ONT1 ---"# Verificar odhcp6cif docker exec ont1 pgrep -f odhcp6c > /dev/null 2>&1; then check_pass "odhcp6c está corriendo en ONT1"else check_fail "odhcp6c NO está corriendo en ONT1" echo " Ejecutar: docker exec ont1 /home/user/start-dhcp6-pd.sh eth1.150 eth2 &"fi# Verificar IPv4ONT1_IPV4=$(docker exec ont1 ip -4 addr show eth1.150 2>/dev/null | grep "inet " | awk '{print $2}')if [ -n "$ONT1_IPV4" ]; then check_pass "ONT1 tiene IPv4 WAN: $ONT1_IPV4"else check_fail "ONT1 NO tiene IPv4 WAN"fi# Verificar IPv6 WANONT1_IPV6_WAN=$(docker exec ont1 ip -6 addr show eth1.150 scope global 2>/dev/null | grep "inet6" | head -1 | awk '{print $2}')if [ -n "$ONT1_IPV6_WAN" ]; then check_pass "ONT1 tiene IPv6 WAN: $ONT1_IPV6_WAN"else check_fail "ONT1 NO tiene IPv6 WAN (IA_NA)"fi# Verificar IPv6 LAN (PD)ONT1_IPV6_LAN=$(docker exec ont1 ip -6 addr show eth2 scope global 2>/dev/null | grep "inet6" | head -1 | awk '{print $2}')if [ -n "$ONT1_IPV6_LAN" ]; then check_pass "ONT1 tiene IPv6 LAN (PD): $ONT1_IPV6_LAN"else check_warn "ONT1 NO tiene IPv6 en LAN - verificar PD"fi# Verificar radvdif docker exec ont1 pgrep radvd > /dev/null 2>&1; then check_pass "radvd está corriendo en ONT1"else check_warn "radvd NO está corriendo en ONT1 - PC1 no recibirá prefijo"fiecho ""# ============================================# Verificar en PC1# ============================================echo "--- Verificando PC1 ---"PC1_IPV6=$(docker exec pc1 ip -6 addr show eth1 scope global 2>/dev/null | grep "inet6" | head -1 | awk '{print $2}')if [ -n "$PC1_IPV6" ]; then check_pass "PC1 tiene IPv6 del prefijo delegado: $PC1_IPV6"else check_warn "PC1 NO tiene IPv6 - ejecutar configuración:" echo " docker exec pc1 sysctl -w net.ipv6.conf.eth1.accept_ra=2" echo " docker exec pc1 ip link set eth1 up"fiecho ""echo "=============================================="echo "Verificación completa"echo ""echo "Para más detalles, ejecutar en los BNGs:"echo " show service active-subscribers hierarchy"echo " show service id 9998 dhcp6 summary"echo " show service id 9998 dhcp6 lease-state"echo "=============================================="
[✓] odhcp6c está corriendo en ONT1[✓] ONT1 tiene IPv4 WAN: 100.80.0.2/29[✓] ONT1 tiene IPv6 WAN: 2001:db8:100::1/128[✓] ONT1 tiene IPv6 LAN (PD): 2001:db8:200:1::1/56[✓] radvd está corriendo en ONT1
PC1 Verification
Checks:
IPv6 address from SLAAC
Address in delegated prefix range
Expected Output:
[✓] PC1 tiene IPv6 del prefijo delegado: 2001:db8:200:1:xxxx:xxxx:xxxx:xxxx/64
Troubleshooting Tips
If checks fail, the script provides remediation steps:
# Start DHCPv6 PD client on ONT1docker exec ont1 /home/user/start-dhcp6-pd.sh eth1.150 eth2 &# Enable IPv6 on PC1docker exec pc1 sysctl -w net.ipv6.conf.eth1.accept_ra=2docker exec pc1 ip link set eth1 up
The script suggests running these commands on BNG:
# Show active subscribers with IPv6show service active-subscribers hierarchy# Show DHCPv6 summaryshow service id 9998 dhcp6 summary# Show DHCPv6 leasesshow service id 9998 dhcp6 lease-state# Show prefix delegationshow service id 9998 dhcp6 lease-state prefix
# 1. Deploy to GitHubcd ~/workspace/source./deploy-github.sh# 2. Enable GitHub Pages (follow instructions)# Go to: https://github.com/[user]/[repo]/settings/pages# Set Source: GitHub Actions# 3. Wait for deployment# Check: https://github.com/[user]/[repo]/actions