Life As A Network Engineer – Rakesh

2xJNCIE-(SP,DC)/CCIE-SP #47613

  • LLM is a technology which needs no introduction.

    LLMs + Networking = Awesome! 😎 Just dropped a playlist with the 9 key prompting bits that’ll help you organize and understand your network stuff way better. You know what to do!

    One of the most important aspect is function calling where you can use the power of structured data and calling a specific tool to help you get the information in a right format. Let me know your thoughts.

  • Transforming Cloud with Oracle’s Dedicated Region Cloud Innovations

    Image – https://www.oracle.com/cloud/cloud-at-customer/dedicated-region/

    Note : All opinions and writings are of my own understanding and may not represent latest or historical product development facts, please consult Oracle Documentation and Sales teams for accurate information.

    Oracle’s Dedicated Region Cloud@Customer (DRCC) has emerged as a transformative solution for organisations requiring cloud capabilities within their own data centers. Recent advancements in DRCC, particularly those announced in 2024 and 2025, have introduced groundbreaking features that redefine network architecture, scalability, and edge computing. This article delves into the technical nuances of these innovations, focusing on their implications for network engineers tasked with designing, deploying, and managing hybrid and multi-cloud environments.

    Architectural Evolution of DRCC: From Regional Deployment to Edge Scalability

    Dedicated Region25: Compact Footprint and Modular Scalability

    Oracle’s introduction of Dedicated Region25 marks a significant shift in on-premises cloud deployment. With a 75% smaller physical footprint compared to previous iterations, this configuration starts at three racks and scales incrementally, enabling organizations to deploy cloud infrastructure in constrained spaces while maintaining access to over 150 OCI services. For network engineers, this modularity necessitates a reevaluation of data center design principles.

    The reduced footprint simplifies integration into existing network topologies but requires meticulous planning for power distribution, cooling, and network redundancy. Engineers must ensure that spine-leaf architectures or traditional three-tier designs accommodate the high-density compute and storage nodes within Dedicated Region25. Furthermore, the smaller scale does not compromise OCI’s core networking features, such as Virtual Cloud Networks (VCNs), subnets, and dynamic routing gateways (DRGs). Adopting Oracle’s recommended hub-and-spoke topology remains critical for enabling secure communication between DRCC instances, on-premises systems, and multicloud environments.

    OCI Roving Edge Infrastructure: AI-Driven Edge Networking

    The 2024 release of OCI Roving Edge Devices with GPUs represents a leap forward in edge computing. Equipped with three GPUs, 56 cores, and 123TB of storage, these ruggedised devices enable AI inferencing in disconnected or remote locations, such as military deployments or offshore oil rigs. For network engineers, this innovation introduces several challenges and opportunities:

    1. Latency Optimisation: By processing data locally, Roving Edge Devices reduce reliance on centralised cloud resources. Engineers must design edge networks with sufficient bandwidth to handle intermittent connectivity while prioritising critical data streams.
    2. Security at the Edge: Deploying zero-trust security models—such as Google’s BeyondCorp framework—becomes essential when edge devices operate in untrusted environments. Network segmentation, encrypted tunnels (IPsec/VPN), and hardware-based secure boot mechanisms are imperative to safeguard sensitive workloads.
    3. Integration with 5G: Verizon’s 5G network slicing techniques, which allocate dedicated virtual networks for specific applications, offer a blueprint for integrating Roving Edge Devices with 5G infrastructure to ensure low-latency, high-throughput connectivity.

    Networking Enhancements for Multicloud and Hybrid Environments

    Oracle Database@Hyperscalers: Cross-Cloud Connectivity

    Oracle’s partnerships with AWS, Azure, and Google Cloud have culminated in Oracle Database@AWS, Oracle Database@Azure, and Oracle Database@Google Cloud, which allow customers to run Oracle databases natively within hyperscaler environments. For network engineers, this multicloud strategy demands robust intercloud connectivity:

    • Cross-Region Disaster Recovery: Oracle Autonomous Database Serverless now supports cross-region replication in Google Cloud, enabling engineers to configure active-passive or active-active architectures across regions like London, Frankfurt, and São Paulo. BGP routing and VPN gateways must be optimised to minimize latency during failover events.
    • Unified DNS Management: Oracle’s Private DNS service, which resolves queries across VCNs and on-premises systems, simplifies hybrid cloud management. Engineers should replace default oraclevcn.com zones with custom domains while automating DNS record updates via Terraform or OCI APIs.

    SDN and NFV Integration for Agile Network Operations

    Software-Defined Networking (SDN) and Network Function Virtualisation (NFV) are central to Oracle’s distributed cloud strategy. The OCI Virtual Cloud Network abstracts underlying hardware, allowing engineers to programmatically configure subnets, route tables, and security lists. Key advancements include:

    • Regional vs. Availability Domain-Specific Subnets: Engineers must decide whether to deploy regional subnets for high availability or AD-specific subnets for workload isolation. Regional subnets span multiple fault domains, making them ideal for stateless applications, while AD-specific subnets reduce cross-zone traffic costs.
    • Dynamic Routing Gateways (DRGs): DRGs facilitate connectivity between VCNs, on-premises networks, and external clouds. With the expansion of Oracle Database@Google Cloud to eight new regions, engineers can leverage DRGs to establish direct peering with Google’s Premium Tier network, bypassing public internet routes.

    Security and Compliance in Distributed Cloud Networks

    Zero-Trust Architecture and Quantum-Resistant Cryptography

    Oracle’s DRCC aligns with industry trends toward zero-trust security, where every access request is authenticated and authorized. For example, Cisco’s intent-based networking uses machine learning to automate policy enforcement, ensuring that only compliant devices access sensitive workloads. Additionally, Oracle has integrated quantum-resistant algorithms into OCI’s Key Management Service (KMS), preparing networks for post-quantum cryptographic threats.

    • Microsegmentation: Isolate workloads using security lists and network security groups (NSGs) to limit lateral movement during breaches.

    -Rakesh

  • Install OLLAMA and deepseek-r1 ON GOOGLE CO-LAB
  • Deepseek-r1 – reasoning and Chain of thought – Network Engineers

    https://www.deepseek.com/ – DeepSeek has taken the AI world by storm. Their new reasoning model, which is open source, achieves results comparable to OpenAI’s O1 model but at a fraction of the cost. Many AI companies are now studying DeepSeek’s white paper to understand how they achieved this.

    This post analyses reasoning capabilities from a Network Engineer’s perspective, using a simple BGP message scenario. Whether you’re new to networking or looking to refresh your reasoning skills for building networking code, DeepSeek’s model is worth exploring. The model is highly accessible – it can run on Google Colab or even a decent GPU/MacBook, thanks to DeepSeek’s focus on efficiency.

    For newcomers: The model is accessed through a local endpoint, with queries and responses handled through a Python program. Think of it as a programmatic way to interact with a chat interface.

    Code block

    Simple code. One function block has prompt set to LLM to be a expert Network engineer. We are more interested in the thought process. The output of the block is a sample BGP output from a industry standard device, nothing fancy here.

    import requests
    import json
    
    def analyze_bgp_output(device_output: str) -> str:
        url = "<http://localhost:11434/api/chat>"
        
        # Craft prompt for analyzing device output
        expert_prompt = f"""As a BGP expert network engineer, analyze this device output and provide:
        1. Current BGP state and any issues identified
        2. Root cause analysis
        3. Recommended actions
    
        Device Output:
        ```
        {device_output}
        ```
        """
        
        payload = {
            "model": "deepseek-r1",
            "messages": [
                {"role": "user", "content": expert_prompt}
            ]
        }
        
        try:
            response = requests.post(url, json=payload, stream=True)
            response.raise_for_status()
            
            full_response = ""
            for line in response.iter_lines():
                if line:
                    try:
                        json_response = json.loads(line.decode('utf-8'))
                        if 'message' in json_response:
                            content = json_response['message']['content']
                            full_response += content
                            print(content, end='', flush=True)
                    except json.JSONDecodeError:
                        continue
                    
            return full_response
            
        except requests.exceptions.RequestException as e:
            print(f"Error connecting to deepseek: {e}")
            return str(e)
        except Exception as e:
            print(f"Unexpected error: {e}")
            return str(e)
    
    # Example usage
    if __name__ == "__main__":
        # Example device output
        sample_output = """
        router1#show ip bgp summary
        BGP router identifier 10.1.1.1, local AS number 65001
        BGP table version is 1234
        2 BGP AS-PATH entries
        0 BGP community entries
    
        Neighbor        V    AS    MsgRcvd    MsgSent    TblVer    InQ    OutQ   Up/Down    State/PfxRcd
        192.168.1.2    4    65002     0         0          0       0      0      never      Active
        192.168.1.3    4    65003     245       239        1234    0      0      00:14:23   23
        """
        
        print("Analyzing BGP device output...\\n")
        analyze_bgp_output(sample_output)
    
    

    First lets inspect the final – output

    **Analysis of Device Output:**
    
    The device output shows a BGP table with an identifier 10.1.1.1 and local AS number 65001, using table version 1234. There are two AS-PATH entries in the BGP table:
    
    1. **Neighbor 192.168.1.2:**
       - **AS:** 65002
       - **V:** 4
       - **MsgRcvd:** 0 (no messages received)
       - **MsgSent:** 0 (no messages sent)
       - **State:** Active
    
    2. **Neighbor 192.168.1.3:**
       - **AS:** 65003
       - **V:** 4
       - **MsgRcvd:** 245 (messages received)
       - **MsgSent:** 239 (messages sent)
       - **State:** Never active
    
    **Current BGP State:**
    - The device has two AS-PATH entries in its BGP table.
    - Neighbor 192.168.1.2 is unreachable or in an inactive state, as indicated by the "never" value and active state.
    - Neighbor 192.168.1.3 has messages received but no outgoing messages sent (MsgSent: 0), which suggests it may be unreachable.
    
    **Root Cause Analysis:**
    The neighbor 192.168.1.3 is configured with an AS number of 65003 and shows message statistics that imply the BGP session to this neighbor has not been properly configured or started. This could be due to a misconfiguration in route reflection settings, incorrect BGP sessions, or issues such as unreachable routes being referenced through this path.
    
    **Recommended Actions:**
    1. **Verify Route Reflection Settings:** Ensure that route reflection is correctly configured for all necessary routes and that the AS numbers are appropriate.
    2. **Check BGP Session Configuration:** Confirm that there are no active BGP sessions with the neighbors 192.168.1.2 and 192.168.1.3 on router1. If a session is missing, initiate it by adding the neighbor to the BGP routes or adjusting route reflection settings.
    3. **Inspect AS Path References:** Review any routes referencing the 65003 AS path for unreachable destinations; this could indicate issues with upstream routes that are being referenced through this AS number.
    4. **Troubleshoot Route Accessibility:** Temporarily disable any routes referencing the unavailable neighbor (192.168.1.2) to isolate whether the issue is related to a misconfigured route or session.
    
    By addressing these areas, the BGP state can be corrected, and routing issues resolved.
    
    

    Lets see the chain-of-thought

    Analyzing BGP device output...
    
    <think>
    Okay, so I'm trying to analyze this BGP output from a device and figure out the current state, any issues, the root cause, and recommended actions. Let me start by looking at the output provided.
    
    First, the device is showing a BGP table with an identifier 10.1.1.1 and local AS number 65001. The table version is 1234, which seems fine because I don't remember BGP having specific version constraints from providers unless they're very old.
    
    There are two AS-PATH entries in the BGP table. The first one is connected to 192.168.1.2 with an AS number 65002, and it's active without any messages received or sent yet. That seems okay because sometimes neighbors might not have exchanged routing information yet.
    
    The second entry is for 192.168.1.3 with AS 65003. Here, there are some messages: 245 received and 239 sent. The table version here is also 1234, which matches the first one, so that's good. It mentions InQ as 0 and OutQ as 0 except for the last entry where it has 1234. Wait, no, actually looking again: the second row shows MsgRcvd=245, MsgSent=239, TblVer=1234, InQ=0, OutQ=0, and then the last part says Up/Down never and State/PfxRcd 00:14:23. So that neighbor is unreachable or in some failed state.
    
    **Hmm, so what's the issue here? Well, BGP AS-PATH entries are supposed to have certain fields filled out correctly when they're reachable. Since both neighbors don't have any messages sent or received except for 192.168.1.3 which has a lot of messages, but some fields like InQ and OutQ aren't filled.**
    
    Wait, maybe I misread that. Let me check again. The first entry after the header is:
    
    Neighbor        V    AS    MsgRcvd    MsgSent    TblVer    InQ    OutQ   Up/Down    State/PfxRcd
    192.168.1.2    4    65002     0         0          0       0      0      never      Active
    
    So MsgRcvd and MsgSent are zero, which is correct because the BGP table hasn't been updated yet when the neighbor is unreachable.
    
    The second entry:
    
    192.168.1.3    4    65003     245       239        1234    0      0      00:14:23   23
    
    So here, MsgRcvd is 245 and MsgSent is 239. That suggests that the device has received some messages but hasn't sent any yet. The TblVer is same as first entry (1234), which is fine because it's a common value. InQ and OutQ are both zero, which means no pending queries for incoming or outgoing messages.
    
    The Up/Down field says never, meaning the BGP session to this neighbor hasn't been started yet. Wait, but in AS-PATH entries, the first time they're added, V is set to a value (like 4 here). Then, once the session is active, V increments up to 9 or something.
    
    So maybe the issue is that one of the neighbors isn't having BGP sessions properly configured. The neighbor 192.168.1.3 has an AS number 65003 and some messages received but no outgoing messages sent yet. That could mean it's trying to reach another route via this BGP path, or perhaps there's a misconfiguration in the route reflection settings.
    
    Another thing is that both neighbors are showing the same table version (1234), which is probably fine as long as they're using the same BGP providers. But if one provider has an older version, it might cause issues with AS numbers and routes not updating properly.
    
    **Wait, but looking at the neighbor entries: 65001 vs. 65002 and 65003. The local AS is 65001 for router1's BGP table, so each neighbor should have a unique AS from that local AS. That seems correct.**
    
    But since one of the neighbors (192.168.1.3) has an AS number 65003, which isn't used by any other device except maybe another router on that network. So perhaps it's trying to reach another route via BGP using this neighbor.
    
    Another point is that in the first entry for 192.168.1.2, all fields are zero except AS and V, so that seems fine because it hasn't been updated yet.
    
    So putting it together: The device has two neighbors with BGP AS numbers. One (192.168.1.3) has messages received but not sent yet, indicating perhaps an unreachable path or a misconfigured session. Since the state is 23 seconds, maybe it's trying to reach a route via this neighbor.
    
    Root cause could be that there's no BGP session active for 192.168.1.3 on router1. So when the device tries to send messages over this path, it can't because the session isn't properly configured or started.
    
    Possible actions would include verifying if the route reflection settings are correct, ensuring the BGP sessions with these neighbors are active and properly configured, perhaps checking for any issues in the AS numbers or routing tables that might be causing this misbehavior. Also, making sure that there's no route poisoning or incorrect routes being sent.
    </think>
    
    
    

    Application for CoT model is really promising

    -Rakesh

  • Managing AWS Complexity: Insights from Dr. Werner Vogels

    https://www.youtube.com/watch?v=aim5x73crbM

    Dr. Werner Vogels’ keynote at AWS re:Invent 2024 explores how simplicity can lead to complexity, highlighting innovations in AWS services and the importance of maintaining manageable systems.

    Highlights

    • 🚀 Simplicity breeds complexity: AWS services like S3 exemplify the journey from simple beginnings to complex systems.
    • 🍕 The Two-Pizza Team: Small, autonomous teams enhance innovation while managing complexity effectively.
    • 🔄 Continuous learning: Emphasis on adapting structures and processes to accommodate growth and change.
    • 🌎 Global scalability: AWS focuses on building technologies that enable businesses to expand effortlessly across regions.
    • 🔍 Importance of observability: Understanding and managing system complexity through effective monitoring and metrics.
    • 🔒 Security by design: Embedding security measures from the outset to ensure robust systems.
    • 🤝 Community involvement: Encouraging tech professionals to support initiatives that address global challenges.

    Key Insights

    • 🧩 Managing Complexity: Systems evolve over time, and complexity is inevitable. Organizations must strategically manage this complexity to avoid fragility while ensuring functionality.
    • ⚙️ Evolvability as a Requirement: Building systems with the ability to evolve in response to user needs is essential. Flexibility in architecture allows for future changes without major disruptions.
    • 🔗 Decoupling Systems: Breaking down monolithic systems into smaller, independently functioning components enhances maintainability, scalability, and adaptability to change.
    • 📊 Predictable Systems: Designing systems that yield consistent performance and predictable outcomes is crucial for managing operational complexity effectively.
    • 🔄 Automation: Automating routine tasks reduces human error and operational burden, allowing teams to focus on more strategic, high-impact work.
    • Value of Time: Utilising synchronized time can simplify complex distributed systems, making it easier to manage transactions and ensure consistency.
    • 🌍 Social Responsibility: Technology professionals have a role in solving global challenges, and sharing expertise can lead to impactful contributions in various communities.
  • How AI Chatbots Improve Network Configuration Management

    Templating and Data Representation: Aspect of Network Automation using a tailor made AI Chatbot just to handle this scenario

    In today’s exploration, we’ll dive into the fascinating world of automation frameworks and how different data formats work together to create powerful, maintainable solutions. Drawing from extensive hands-on experience, I’ll share insights into how XML, JSON, and YAML complement each other in modern automation landscapes.

    The Three Pillars of Automation Data Handling

    1. Expression Through XML XML has long served as the backbone of structured data expression. Its verbose yet precise nature makes it particularly valuable for scenarios requiring strict schema validation and complex hierarchical relationships. Think of XML as the detailed blueprints of your automation architecture.
    2. Serialisation with JSON JSON has revolutionised data interchange in modern applications. Its lightweight structure and native compatibility with JavaScript have made it the de facto standard for API communications. Consider JSON as your data’s travel format – efficient, universally understood, and easy to process.
    3. Presentation via YAML YAML brings human-readability to configuration management. Its clean syntax and support for complex data structures make it ideal for writing and maintaining configuration files. Think of YAML as your user interface to data representation – intuitive, clean, and maintainable.

    The Power of Integration: Jinja2 and YAML

    When we combine Jinja2’s templating capabilities with YAML’s presentation strengths, we unlock powerful automation possibilities:

    This approach offers several advantages:

    • Template reusability across different environments
    • Dynamic configuration generation
    • Reduced human error through automation
    • Clear separation of logic and presentation

    Lets take this example from Juniper Networks configuration, this is typically the blue-print on PE router and scales to some hundreds if not thousands.

    set routing-instances CE2_L3vpn protocols bgp group CE2 type external
    set routing-instances CE2_L3vpn protocols bgp group CE2 peer-as 65420
    set routing-instances CE2_L3vpn protocols bgp group CE2 neighbor 172.16.2.1
    set routing-instances CE2_L3vpn instance-type vrf
    set routing-instances CE2_L3vpn interface xe-0/0/0:1.0
    set routing-instances CE2_L3vpn route-distinguisher 192.168.0.3:12
    set routing-instances CE2_L3vpn vrf-target target:65412:12
    set routing-options router-id 192.168.0.3
    set routing-options autonomous-system 65412
    set protocols bgp group ibgp type internal
    set protocols bgp group ibgp local-address 192.168.0.3
    set protocols bgp group ibgp family inet-vpn unicast
    set protocols bgp group ibgp neighbor 192.168.0.1
    set protocols mpls label-switched-path lsp_to_pe1 to 192.168.0.1
    set protocols mpls interface xe-0/0/0:0.0
    set protocols ospf traffic-engineering
    set protocols ospf area 0.0.0.0 interface lo0.0 passive
    set protocols ospf area 0.0.0.0 interface xe-0/0/0:0.0
    set protocols rsvp interface lo0.0
    set protocols rsvp interface xe-0/0/0:0.0

    When I tackled the challenge of automating configuration translations, I discovered that the secret lies not in complex programming, but in crafting a precise, well-structured prompt. Let me share my approach to building this solution.

    Generic Prompt for AI:
    
    "You are an expert network engineer with a deep understanding 
    of network configuration best practices. Your task is to generate
    a configuration template and a corresponding variable file based 
    on the provided configuration output. The configuration output may
    include network-specific parameters such as IP addresses, 
    routing protocols, device settings, and other network features.
    
    Please perform the following tasks:
    
    Create a Configuration Template (e.g., Jinja2 template):
    
    Generate a template that can be used to generate network 
    device configurations based on variable input.
    The template should include placeholders for dynamic 
    values like IP addresses, routing protocols, device names,
    and any other network settings.The template should be flexible, 
    reusable, and modular for various network use cases 
    (e.g., BGP, OSPF, VLAN configurations).
    Generate a Variable File (e.g., YAML or JSON):
    
    Create a file that contains all the necessary configuration parameters
    (variables) to feed into the template.Ensure the variable
    file is structured and clear, with labels for each network
    configuration item (e.g., IP addresses, interfaces, 
    routing protocols, neighbor IPs, etc.).
    The variables should be customizable, making
    it easy for users to update their network settings as needed.
    

    This approach lets you focus on what matters – solving problems and building systems – while using tools and resources to handle the technical details. Remember, even experienced developers regularly consult documentation and use AI tools to enhance their workflow.

    -Rakesh

  • Optimizing OSPF RFC Access with Serper API and Large Language Models

    Disclaimer: All Writings And Opinions Are My Own And Are Interpreted Solely From My Understanding. Please Contact The Concerned Support Teams For A Professional Opinion, As Technology And Features Change Rapidly.

    This series of blog posts will focus on one feature at a time to simplify understanding.

    At this point, ChatGPT—or any Large Language Model (LLM)—needs no introduction. I’ve been exploring GPTs with relative success, and I’ve found that API interaction makes them even more effective.

    But how can we turn this into a workflow, even a simple one? What are our use cases and advantages? For simplicity, we’ll use the OpenAI API rather than open-source, self-hosted LLMs like Meta’s Llama.

    Let’s consider an example: searching for all OSPF-related RFCs on the web. Technically, we’ll use a popular search engine, but to do this programmatically, I’ll use Serper. You can find more details at https://serper.dev. Serper is a powerful search API that allows developers to programmatically access search engine results. It provides a simple interface to retrieve structured data from search queries, making it easier to integrate search functionality into applications and workflows.

    Let’s build the first building block and try to fetch results using Serper. When you sign up, you’ll get free credits to try it out, so feel free to sign up and use it across your projects.

    import requests
    import json
    
    url = "https://google.serper.dev/search"
    
    payload = json.dumps({
      "q": "OSPF RFCs from site rfc-editor.org"
    })
    headers = {
      'X-API-KEY': 'xx',
      'Content-Type': 'application/json'
    }
    
    response = requests.request("POST", url, headers=headers, data=payload)
    
    print(response.text)
    
    
    Response 
    
    {
      "searchParameters": {
        "q": "OSPF RFCs from site rfc-editor.org",
        "type": "search",
        "engine": "google"
      },
      "organic": [
        {
          "title": "RFC 2328: OSPF Version 2",
          "link": "https://www.rfc-editor.org/rfc/rfc2328",
          "snippet": "This memo documents version 2 of the OSPF protocol. OSPF is a link-state routing protocol. It is designed to be run internal to a single Autonomous System.",
          "position": 1
        },
        {
          "title": "Information on RFC 2328",
          "link": "https://www.rfc-editor.org/info/rfc2328",
          "snippet": "This memo documents version 2 of the OSPF protocol. OSPF is a link- state routing protocol. [STANDARDS-TRACK] For the definition of Status, see RFC 2026.",
          "position": 2
        },
        {
          "title": "Information on RFC 2178 - » RFC Editor",
          "link": "https://www.rfc-editor.org/info/rfc2178",
          "snippet": "This memo documents version 2 of the OSPF protocol. OSPF is a link-state routing protocol. It is designed to be run internal to a single Autonomous System.",
          "position": 3
        },
        {
          "title": "RFC 5340: OSPF for IPv6",
          "link": "https://www.rfc-editor.org/rfc/rfc5340.html",
          "snippet": "This document describes the modifications to OSPF to support version 6 of the Internet Protocol (IPv6).",
          "position": 4
        },

    Now, we need a framework to process this data and determine the next steps. One example of such a framework is crew.ai.

    Crew.ai is an open-source Python framework for creating collaborative AI agents to tackle complex tasks. It offers developers a versatile and robust platform for building and managing multi-agent systems, harnessing the power of large language models.

    Using Crew.ai, you can design specialized AI agents, assign them specific roles, and establish workflows for them to follow. This framework facilitates the development of advanced AI applications capable of handling a wide array of tasks, ranging from data analysis to innovative problem-solving.

    While I’ll explore the crew.ai structure in depth in a future post, let’s focus now on its capabilities and how it can be used to process data.

    (crewaiproject) ubuntu@llama:~/crewaiproject/rfcfetcher$ crewai run
    Running the crew
     [2024-09-07 15:55:35][DEBUG]: == Working Agent: OSPF RFCs Senior Data Researcher
    
     [2024-09-07 15:55:35][INFO]: == Starting Task: Conduct a search for any RFC from rfc-editor.org and programmatically parse  the table of contents (TOC). Ensure that each subsection and title are included accurately.
    
    
    
    > Entering new CrewAgentExecutor chain...
    To accomplish the task, I need to search for OSPF RFCs on rfc-editor.org and then programmatically parse the table of contents (TOC) for each RFC. I will start by searching for OSPF RFCs on rfc-editor.org to gather the relevant URLs.
    
    Action: Search the internet
    Action Input: {"search_query": "OSPF RFC site:rfc-editor.org"}
    
    ^ above action will use serper.dev functionality to get the information and 
    this will be passed to OPENAI llm to organise this information
    
    Sample redacted output 
    
    RFC Number - RFC 4750
    Title      - OSPF Version 2 Management Information Base
    URL        - [https://www.rfc-editor.org/rfc/rfc4750](https://www.rfc-editor.org/rfc/rfc4750)
    Subsections:
      - 1. Introduction
      - 2. The SNMP Network Management Framework
      - 3. Overview
      - 4. Definitions
      - 5. Object Definitions
      - 6. Security Considerations
      - 7. Acknowledgments
      - 8. References
    
    RFC Number - RFC 5613
    Title      - OSPF Link-Local Signaling
    URL        - [https://www.rfc-editor.org/rfc/rfc5613](https://www.rfc-editor.org/rfc/rfc5613)
    Subsections:
      - 1. Introduction
      - 2. OSPF Link-Local Signaling Overview
      - 3. OSPF LLS Data Block
      - 4. LLS TLVs
      - 5. Backward Compatibility
      - 6. Security Considerations
      - 7. IANA Considerations
      - 8. Acknowledgments
      - 9. References

    Building workflows towards agentic workflows enables better organization of information, faster retrieval, and less need to memorize it. I’ll delve into building this in the next post.

    -Rakesh

  • Explore ContainerLab: Simulate Complex Network Topologies with Docker Containers

    I stumbled across this tool, while am always a fan of VRNET-LAB https://github.com/vrnetlab/vrnetlab and it operates on docker containers, i could not get it properly bridge it with Local network meaning reachability to internet is something that I never worked on.

    A container lab is a virtualized environment that utilises containers to create and manage network testing labs. It offers a flexible and efficient way to simulate complex network topologies, test new features, and perform various network experiments.

    One striking feature that i really liked about containerlab is that representation is in a straight yaml which most of the network engineers now a days are Familiar with and its easy to edit the representation.

    Other advantages

    • host mappings are done automatically
    • Traffic capture is done with ease

    Host mappings after spinning up the lab

    Slide explaining the capture process – Courtesy Petr Ankudinov (https://arista-netdevops-community.github.io/building-containerlab-with-ceos/#1)

    https://containerlab.dev/quickstart/ – Will give you how to do a quick start and install containerlab.

    https://github.com/topics/clab-topo – Topologies contributed by community

    https://github.com/arista-netdevops-community/building-containerlab-with-ceos/tree/main?tab=readme-ov-file – Amazing Repo

    https://arista-netdevops-community.github.io/building-containerlab-with-ceos/ -> This presentation has some a eVPN topology and also explain how to spin up a quick eVPN with ceos Arista done by Petr Ankudinov

    I dont want to get into lot of details which are already done by Petr, here is the base topology that he uses

    Arista cEOS Evpn – Courtesy Petr Ankudinov (link above)

    I wrote an additional Jupyter notebook just to abstract the idea.

    I dont want to get into the usual details on how outputs looks on a cEOS etc as my intention was to convey the container lab setup and its ease.

    -Rakesh

  • Disclaimer: All Writings And Opinions Are My Own And Are Interpreted Solely From My Understanding. Please Contact The Concerned Support Teams For A Professional Opinion, As Technology And Features Change Rapidly.

    And No! This can’t replace the accuracy of static templating configurations. This helps us to better understand and develop the templates. This was almost rocket science to me when I first got to know about them.

    Most modern day deployments have some sort of variable files and template files (YAML and Jinja2). These can be intimidating. It was mysterious. When I first looked at them years ago, I found them confusing. Today, with LLM you don’t have to really be worried about how to generate it. The parser in itself can come up on the fly to generate for popular networking gear. More than that, it’s more than willing to take in the data to spit out whatever configuration is needed.

    Lets say I just appreciated the way the configuration files are generated today. I wanted to quickly see if an LLM can generate the config. It also do the deployment for me. Then it helps me with some pre-checks, all without writing the code.

    Let’s not go too far into the future. Let’s try to see if we can generate configuration for a popular vendor, Juniper. We will do this just by asking LLM. We will also ask it what template it has used. We want to save it. We will then feed it to improvise.

    import openai
    import yaml
    
    # Load the YAML data
    with open('/home/ubuntu/network-automation/interface_data.yaml', 'r') as file:
        interface_data = yaml.safe_load(file)
    
    prompt = f"""Generate the interface configuration for a Juniper router:\n\nData:\n{interface_data}\n\nGenerated Configuration:\n.
               Also, display me set based and code style based configuration.\n
               Finally, also print the Jinja2 template that you used for future reference"""
    openai.api_key = "sk-proj-x"
    
    response = openai.chat.completions.create(
        model="gpt-4",
        messages=[
            {"role": "system", "content": "You are an expert network engineer, great at generating configurations."},
            {"role": "user", "content": prompt},
        ]
    )
    
    # Print the generated configuration
    generated_config = response.choices[0].message.content.strip()
    print(generated_config)
    

    Set Based Configuration:
    ```
    set interfaces ge-0/0/0 description "Link to Router A"
    set interfaces ge-0/0/0 unit 0 family inet address 192.168.1.1/24
    set interfaces ge-0/0/1 description "Link to Router B"
    set interfaces ge-0/0/1 unit 0 family inet address 192.168.2.1/24
    set interfaces ge-0/0/2 description "Link to Router C"
    set interfaces ge-0/0/2 unit 0 family inet address 192.168.3.1/24
    ```
    
    Code Style Configuration:
    ```
    interfaces {
        ge-0/0/0 {
            description "Link to Router A";
            unit 0 {
                family inet {
                    address 192.168.1.1/24;
                }
            }
        }
        ge-0/0/1 {
            description "Link to Router B";
            unit 0 {
                family inet {
                    address 192.168.2.1/24;
                }
            }
        }
        ge-0/0/2 {
            description "Link to Router C";
            unit 0 {
                family inet {
                    address 192.168.3.1/24;
                }
            }
        }
    }
    ```
    
    Jinja2 Template:
    ```jinja2
    interfaces {
        {% for interface in interfaces %}
        {{ interface.name }} {
            description "{{ interface.description }}";
            unit {{ interface.unit }} {
                family {{ interface.family }} {
                    address {{ interface.address }};
                }
            }
        }
        {% endfor %}
    }
    ```
    The template will consume a dictionary with the key "interfaces" and a list of dictionaries with keys "name", "description", "unit", "family", "address". The template generates code-style configuration based on the input.

    #Interface Data YAML
    
    interfaces:
      - name: ge-0/0/0
        description: "Link to Router A"
        unit: 0
        family: inet
        address: 192.168.1.1/24
    
      - name: ge-0/0/1
        description: "Link to Router B"
        unit: 0
        family: inet
        address: 192.168.2.1/24
    
      - name: ge-0/0/2
        description: "Link to Router C"
        unit: 0
        family: inet
        address: 192.168.3.1/24
    

    I will explore a case where this deploys it and verifies it.

    -Rakesh

  • Opensource LLM Models – Meta llama / Meta Codellama ? Deploying In-house ? Context of Networking!

    Disclaimer: All Writings And Opinions Are My Own And Are Interpreted Solely From My Understanding. Please Contact The Concerned Support Teams For A Professional Opinion, As Technology And Features Change Rapidly.

    In a world where even your toaster might soon have a PhD in quantum physics, LLMs are taking over faster than a cat video going viral! LLMs are becoming increasingly powerful and are being integrated into various business and personal use cases. Networking is no different. Due to reasons like privacy, connectivity, and cost, deploying smaller form factor models or larger ones (if you can afford in-house compute) is becoming more feasible for faster inference and lower cost.

    The availability and cost of model inference are improving rapidly. While OpenAI’s ChatGPT-4 is well-known, Meta and other firms are also developing LLMs that can be deployed in-house and fine-tuned for various scenarios.

    Let’s explore how to deploy an open-source model in the context of coding. For beginners, ease of deployment is crucial; nothing is more off-putting than a complicated setup.

    Reference : Ollama.com (https://github.com/ollama/ollama?tab=readme-ov-file) simplifies fetching a model and starting work immediately.

    Visit ollama.com to understand what a codellama model looks like and what is needed. [https://ollama.com/library/codellama]

    How do we set this up? On an Ubuntu machine, the first step is to perform a snap-install. It’s already installed on my system.

    Let’s pull the model from Ollama.

    A sample query with 7B parameters is impressive and runs completely locally. Meta llama is licensed for both research and commercial use. Reference: https://llama.meta.com/

    >>> write me a program which connects to a linux machine and get top output for last 30 seconds
    ```
    import paramiko
    import time
    
    # create a SSH client object
    client = paramiko.SSHClient()
    
    # set the hostname and port number of the remote server
    hostname = 'remote_server'
    port = 22
    
    # connect to the remote server using SSH
    client.connect(hostname=hostname, port=port, username='username', password='password')
    
    # create a command object with top command and options
    
    # filter the data by source and destination IP addresses
    filtered_df = df[df['ip.src'] == '192.168.1.100' and df['ip.dst'] == '192.168.1.101']]
    
    # print the filtered data
    print(filtered_df)
    ```
    This program will capture the output of tshark command using subprocess module, parse it using pandas, filter out all the rows that do not contain the source and destination IP addresses 192.168.1.100 and 192.168.1.101 respectively, and
    then print the filtered data to the console.
    You can replace 'pcap_file.pcap' with your own pcap file name

    Just like codellama, there are other models such as the general model llama:7b, which has impressive benchmarks. You can also integrate it as an API endpoint. Use it to create unit tests, generate more code, understand scripts, and much more. Hope this helps.

    -Rakesh