2Instituto de Biotecnología, CICVyA, INTA Castelar (1712) Hurlingham, Buenos Aires Province, Argentina.
Leptospirosis is a zoonosis of ubiquitous distribution caused by spirochetes. Leptospires exist either as saprophytic water-associated organisms or as animal pathogens that can survive in water. Previous works have demonstrated that both saprophytic and pathogenic leptospires are able to produce functional biofilms, which consist of a community of bacteria embedded in an extracellular matrix attached to a surface. This structure is believed to provide protection from environmental aggressiveness. In the present study, we analyzed the capacity of biofilm formation both of a a recent field isolate of Leptospira interrogans serovar Pomona obtained from an aborted swine fetus and of the saprophytic Leptospira biflexa serovar Patoc. We used light microscopy, immunofluorescence, and scanning electron microscopic examinations on glass and polystyrene plate models to evaluate the process in vitro. The ability to form bacterial aggregations in vivo was tested using pregnant guinea pigs infected with both strains. We obtained biofilms both on glass and plastic surfaces. Scanning electron microscopic analysis showed differences in the biofilm structure formed by both strains. L. interrogans serovar Pomona cell aggregations were observed in placental tissues by light microscopy. Biofilms and cell aggregations are consistent with the life of saprophytic strains in water and could help pathogenic strains to colonize the host and lead to abortion in pregnant animals.
Agregaciones celulares in vivo de Leptospira interrogans producidas por un aislamiento porcino capaz de formar biofilm. La leptospirosis es una zoonosis de amplia distribución causada por el género Leptospira. Las leptospiras existen de manera saprófita asociadas a ambientes acuáticos o como patógenos animales que también pueden sobrevivir en el agua. Trabajos previos demostraron que tanto las leptospiras saprófitas como las patógenas tienen la capacidad de formar biofilms, que consisten en una comunidad de bacterias embebidas en una matriz extracelular adherida a una superficie. Esta estructura tendría la función de proveer protección contra el medioambiente. En este estudio, analizamos la capacidad de formar biofilm en un aislamiento obtenido recientemente de un feto porcino abortado, caracterizado como Leptospira interrogans serovar Pomona, y en la bacteria saprófita Leptospira biflexa serovar Patoc. Se estudió la formación de biofilm en distintas superficies (vidrio y poliestireno), las que se evaluaron por microscopía óptica, inmunofluorescencia y microscopía electrónica de barrido. La capacidad de formar agregaciones bacterianas in vivo se evaluó utilizando un modelo de cobayas preñadas infectadas con ambas cepas. Se obtuvieron biofilms tanto en las superficies plásticas como de vidrio. La microscopía de barrido mostró diferencias en la estructura del biofilm formado entre ambas cepas. Se observaron agregaciones celulares en vasos placentarios de los animales infectados con L. interrogans serovar Pomona. Los biofilms y las agregaciones celulares son compatibles con la vida saprofítica en el agua y podrían favorecer a los microorganismos patógenos en la colonización del hospedador, lo que podría llevar al aborto en los animales preñados.
Among the advances in microbiology that have taken place over the past 50 years, one of the most subtle has been the realization of the extent to which microbial growth and development occurs on surfaces in complex communities. Claude Zobell and colleagues noted that aquatic bacteria are more numerous on the solid surfaces of sample containers than as single suspended cells (19). Biofilm formation is an ancient and integral component of the prokaryotic life cycle, and is a key factor for survival in diverse environments. Recent advances have shown that biofilms are structurally complex, dynamic systems with attributes of both primordial multicellular organisms and multifaceted ecosystems (5, 8). Biofilms are complex structures composed of millions of bacteria that work in a coordinated way either to avoid the phagocytic cells or resist the antibiotic action within the host (7).
Leptospirosis is a zoonosis of ubiquitous distribution caused by the spirochete of the genus Leptospira. Nowadays, leptospirosis is identified as a reemerging infectious disease that can be contracted either through direct contact with infected animals or from a contaminated environment due to the capacity of leptospires to survive in soil and water for long periods (16).
Singh et al. described a method based on a culture-independent direct amplification and sequencing of 165 subclones from community biofilm 16S rDNA that revealed that 20%of the identified bacteria corresponded to Leptospira spp. (16). Recently, Ristow et al. (15) described the formation of biofilms in saprophytic and pathogenic leptospires in vitro for the first time. The long-term colonization of the proximal renal tubules of rats by pathogenic leptospires is now believed to proceed via the formation of cell aggregates (2). Thus, biofilm formation may also play an important role in maintaining a chronic carriage of the pathogen Leptospira interrogans in animal reservoirs. For these reasons, we tested the ability of a recent local isolate of L. interrogans serovar Pomona obtained from an aborted pig to form biofilms in vitro and, as a preliminary study, its capacity to form bacterial aggregations in placental vessels of pregnant guinea-pigs.
The L. interrogans field strain was isolated in our laboratory from a urine sample of an aborted pig belonging to an intensive production herd from Buenos Aires province (Argentina). The isolate was first serotypified as L. interrogans serovar Pomona by the microagglutination test (MAT) (4). Genotyping using Variable Number Tandem Repeat (VNTR) and Multilocus Sequence Typing (MLST) rendered that the isolate belong to the most common genotypes found in serovar Pomona, VNTR profile: 4, 1, 6, 10, 8, 2, 3, and sequence type (ST) 37 (9, 12, 17). The saprophytic strain used was Leptospira biflexa serovar Patoc. The strains were cultured at 30 °C in Ellinghausen-McCullough- Johnson-Harris (EMJH) medium (Difco, USA) supplemented with 10 % (vol/vol) rabbit serum, 0.015 % (wt/vol) L-asparagine, 0.001 % (wt/vol) sodium pyruvate, 0.001 % (wt/vol) calcium chloride, 0.001 % (wt/vol) magnesium chloride, 0.03% (wt/vol) peptone, and 0.02 % meat extract (wt/vol) for 5 days until a cellular concentration of 1 x 108 bacteria/ml was reached.
Adherence to glass surfaces: Sterile microscope glass slides (25.4mm x 76.2mm x 1.2mm) and glass coverslips (18 x 18mm) were placed into sterile microscopy glass jars containing EMJH medium inoculated with L. interrogans serovar Pomona and L. biflexa serovar Patoc separately. The jar caps were sealed to avoid desiccation and cultures were grown at 30 °C. The experiment was performed in triplicate. The slides and the coverslips were removed from the jars at different time intervals (5, 15, 30 and 40 days), rinsed three times with phosphate buffered saline (PBS) 1X in order to eliminate the planktonic non-adherent bacteria and dried out. The slides were observed by light microscopy using the Whartin-Starry (W-S) staining method and Immunofluorescence (IF) using a polyvalent conjugate (USDA, USA) (1, 4). The slides were observed at a magnification of 1000X. The coverslips were used for Scanning Electron Microscopy (SEM) and fixed in 2.5 % glutaraldehyde at room temperature for 1 h. The fixed samples were gradually dehydrated in (V/V) 10 %, 30 %, 50 %, 70 %, 90 % and 100 % ethanol baths, desiccated and carbon evaporated. The samples were then observed under a JEOL JSM 6360LV field emission scanning electron microscope (JEOL Ltd, Japan).
Adherence to polystyrene surfaces: Sterile microscope coverslips (Thermanox, Nunc) were aseptically placed into 24-well polystyrene plates along with 200 µl of the EMJH media inoculated with the corresponding strain and incubated at different time points (5, 15, 30 and 40 days). Eighteen wells were used for the strains and the remaining six were used as control medium without inoculation. The cultures were stopped at the fixed times. The medium was removed and the coverslips were rinsed thoroughly as previously described with PBS 1X, W-S stained and observed by light microscopy and IF as previously described.
In a previous work, the capacity of the swine isolate to induce abortion was studied in guinea pigs at different stages of pregnancy. Hartley pregnant guinea pigs that weighed 200 g were injected intraperitoneally with 1.5 x 107 of the swine isolate or the saprophytic strain in a final volume of 1 ml of EMJH. Animals were monitored daily for signs of illness. All the animals infected with the pathogenic strains aborted. Abortion was observed at the different stages of pregnancy studied (3). The presence of bacterial aggregations in placental vessels was tested only in 40-day pregnant guinea pigs. This stage of pregnancy was used according to the size of placental vessels. Three animals were inoculated intraperitoneally using 1.5 x 107 bacteria/ml of the swine isolate typified as L. interrogans serovar Pomona and other three were inoculated with L. biflexa serovar Patoc. The animals inoculated with the swine isolate were euthanized when the abortion occurred. Placenta tissue was extracted and analized for the presence of leptospiras by light microscopy. The placenta samples were fixed on 10 % formol and paraffinic tissue slides were prepared for the staining. The W-S staining technique was used and the samples were observed under a Leitz-Dialux microscope at a magnification of 1000X. All animal studies were approved by the Animal Research Care Committee of the National Institute of Agropecuarian Technology (INTA).
We compared the ability of a recent swine isolate of L. interrogans serovar Pomona and the saprophytic L. biflexa serovar Patoc to form biofilms on abiotic surfaces. We used light microscopy (Figure 1) and immunofluorescence (Figure 2) to observe the biofilm formation on glass surfaces and polystyrene coverslips at short (5 and 15 days) and long (30 and 40 days) incubation times. The swine isolate was able to aggregate and colonize most of the surface as compared with the saprophytic strain, in which case some remaining free bacteria could be observed at short incubation times (5 and 15 days) (Figures 1 and 2: A, B), whereas at long incubation times (30 and 40 days) both strains reached the same area of colonization (Figures 1 and 2: C, D). Both strains resisted the washes performed at the different incubation times. The results were the same when the strains were grown in polystyrene coverlips (data not shown).
Figure 1. Light microscopy of biofilm formation using the Whartin-Starry staining method. Glass slides were evaluated at different times. A: 5 days; B: 15 days; C: 30 days, and D: 40 days of biofilm formation. Magnification: 1000X.
Figure 2. Immunofluorescence assays for assessment of biofilm formation on glass slides. A: 5 days; B: 15 days; C: 30 days, and D: 40 days. Magnification: 1000X.
Scanning electronmicroscopy was used to analyze the differences in the biofilm structures observed between both strains (Figure 3). The biofilm formed by L. interrogans swine isolate was able to cover most of the glass coverslip surface (Figure 3, 1A) as compared with that formed by L. biflexa that was set up dispersed on the glass surface (Figure 3, 2A and 2B). L. interrogans formed a dense structure where an intricate network of bacteria was observed (Figure 3, 1B and 1C). The structure formed by L. biflexa was less compact than that formed by L. interrogans and individual leptospires were observed on the surface (Figure 3, 2A).
Figure 3. Scanning electron microscopy showing the structure of biofilm formation on glass slides. 1A: L. interrogans serovar Pomona (1700X). 1B: L. interrogans serovar Pomona (7000X). 1C: Higher magnification of the inset (10 000X). 2A: L. biflexa serovar Patoc. 2B: Higher magnification of the inset (8000X).
The presence of cells aggregations was tested in 40-day pregnant guinea pigs. One of the three animals inoculated with the L. interrogans serovar Pomona aborted at 7 days pi. The necropsy was performed and placental samples were taken for W-S tissue staining. The other two animals aborted at 10 days pi and were euthanized following the same tissue treatment. None of the animals inoculated with L. biflexa serovar Patoc aborted, therefore, the animals were euthanized and placenta samples were taken.The W-S tissue staining revealed bacterial aggregations on the vascular endothelium of placental vessels only in the animals inoculated with the pathogenic isolate (Figure 4A). The animals inoculated with the saprophytic strain showed no bacterial aggregations but simple unique bacteria on the vascular endothelium (Figure 4B).
Figure 4. Warthin-Starry staining of placental vessels from infected pregnant guinea pigs. Panel A: L. interrogans serovar Pomona. Black arrows show leptospire aggregations. Panel B: L. biflexa serovar Patoc. Blue arrow shows no bacterial aggregations (1000X).
Leptospires can live in many different environmental conditions, such as water and soil, and the pathogenic species can also live in the microenvironment within the host. One of the mechanisms that could facilitate these adaptations is their capacity to form and maintain biofilms. Within a biofilm, bacteria become attached to a surface and form complex communities, which are able to interact with each other through intercellular communication and thus allow rapid adaptations to changing environments. The microorganisms within biofilms are notorious for their resistance towards the host immune response and antibacterial agents, as compared to their free-living planktonic counterparts (8). Twenty percent of bacterial biofilms are due toLeptospira spp., especially in water systems (16). Previous works have reported that Leptospira spp. can establish all the stages of a biofilm formation described by Hall-Stoodley et al. (8, 15).
According to these previous findings and because of the capacity of pathogenic leptospires to invade different mammalian tissues and to remain as a reservoir for further transmission, we decided to test the ability of a recent swine isolate to form biofilms in vitro and cell aggregations in vivo. The strain was isolated from a urine sample of an aborted pig and characterized serologically as L. interrogans serovar Pomona. In a previous work the strain pathogenicity was tested at different stages of pregnancy in a guineapig model and found that all the animals aborted, indicating that this strain was pathogenic and responsible for the pig abortion (3). In this work, the pathogenic isolate was compared with the saprophytic L. biflexa serovar Patoc. Light microscopy and immunoflurorescence showed that both strains formed layers of similar density in glass slides at long incubation times (40 days). At short incubation times (5 days), the pathogenic strain developed a thicker layer than that of the saprophytic strain (Figures 1 and 2, A and B). The plastic surfaces analyzed (polysterene slides and coverslips) rendered the same results (data not shown).The biofilms formed by both strains were resistant to the washes performed in both kinds of surfaces at both short and long incubation times. These results differ from those obtained by Ristow et al., who observed that L. interrogans was not resistant to the washes performed on the biofilm growing in a plastic surface at short incubation times. The authors suggested that this may be due to the fastidious growth rate of a recent pathogenic isolate growing in a static condition (15). Although a continuous-culture biofilm system was suggested to improve the bacterial attachment to the surface, the results shown in our study suggest that even when a static growth condition is used, a recent pathogenic low passage isolate may establish a complete biofilm structure if long incubation times are allowed and that this structure is resistant to washes. This is consistent with the SEM results obtained in our study where the biofilm structure observed in L. interrogans serovar Pomona covered almost all the surface and was thicker than the one formed by L. biflexa, where single leptospires were observed when long incubation time was tested.
Previous works have demonstrated that leptospires show evidence of social behavior, which may play a major role in leptospiral survival and transmission. Once the spirochetes reach natural collections of fresh water, they may detect the viscous milieu formed by cell capsules or biofilms from other organisms, upon which Leptospira cells aggregate (18). The animal experiments presented here allowed us to demonstrate that the recent pathogenic isolate L. interrogans serovar Pomona is able to aggregate in the placental vessel walls of pregnant guinea pigs, in contrast with the results obtained with the saprophyte strain. The presence of aggregates of pathogenic leptospires in placental vessels could be associated with the impairment of the mother-fetus interchange, which could be one of the reasons leading to abortion. The result is consistent with the fact that the different colonization factors that have been identified in L. interrogans serovar Copenhageni and serovar Lai genomes (11, 14) are absent in the L. biflexa genome (13). These factors correspond to different families of afimbrial adhesins that may contribute to the first steps of infection. The first family includes three paralogous genes, ligA, ligB and ligC, recently identified in L. interrogans and in Leptospira kirshneri, which codify for proteins with bacterial immunoglobulin-like (Big) repeat domains (10). The second family of leptospiral adhesin candidates consists of three integrin alpha-like proteins (LIC12259, LIC10021, and LIC13101) (11). These integrins are predicted to be integral membrane proteins, which would support their potential role in ligand-binding interactions on the leptospiral surface and may be involved in the establishment of bacterial aggregations observed in vivo.
Although more experiments are needed to prove this last hypothesis, in the present work we applied a successful model for the study of biofilm formation in vitro and cell aggregations in vivo. This model may be helpful in future studies aimed at understanding the mechanisms developed by pathogenic leptospires at the different stages of pregnancy that lead to abortion.


text:
Trump launches place to post ahead of Facebook board ruling on his ban
President Donald Trump participates in a video teleconference call with members of the military on Thanksgiving, Thursday, Nov. 26, 2020, at the White House in Washington. (AP Photo/Patrick Semansky)
5 May, 2021, 10:28 am
Former President Donald Trump on Tuesday launched a space on his website where he can post messages that can be shared by others to Twitter and Facebook, sites where he remains banned.
The move comes a day before a decision from Facebook Inc's oversight board on whether to uphold Trump's indefinite suspension from the platform. Trump was barred from a slew of social media platforms following the deadly Jan. 6 storming of the US Capitol by his supporters.
Trump's senior adviser, Jason Miller, said in a tweet that this collection of posts was not the social media platform that Trump has plans to launch. "We'll have additional information coming on that front in the very near future," he tweeted.
The site, which was first reported by Fox News, is dubbed "From the Desk of Donald J. Trump" and contains posts from Trump that can be shared and liked. A source familiar with the matter said it was built by Campaign Nucleus, the digital services company created by Trump's former campaign manager Brad Parscale.
Posts on the site repeated Trump's false claim that he lost the 2020 election because of widespread voter fraud and denigrated fellow Republicans who have been critical of him like Senator Mitt Romney and Representative Liz Cheney.
Twitter Inc. and Facebook have both removed content posted from other accounts that they said tried to circumvent their bans on Trump.
A Twitter spokesman said sharing content from the website would be permitted as long as the material did not otherwise break Twitter's rules, but that attempts to circumvent a suspension would not be permitted — for example, imitating a suspended account to try to replace it.
He said Twitter would look out for any such cases.
Facebook did not immediately respond to a request for comment on how it would treat posts shared from the new space.
Twitter, which Trump used heavily and where he had 88 million followers, has said its ban on him is permanent, even if he runs for office again. Alphabet Inc's YouTube has said it will restore Trump's channel when it decides the risk of violence has decreased.

redpajama_set_name: RedPajamaCommonCrawl


Apple has published four more videos to its official YouTube channel in its "iPhone Can Do What?" series, promoting the processing performance, Find my iPhone, Apple Pay Cash, and Dual SIM functionality of the company's smartphones.
Media coverage from the Mobile World Conference in Barcelona has worked to establish a narrative that Apple is dangerously behind other companies in releasing support for 5G mobile networks and the foldable screens that enable a phone to convert into a tablet. Yet, the last decade of MWC shows that vendor announcements aren't really worth very much.
MWC could be viewed as the mobile industry's equivalent to the Consumer Technology Association's CES trade show. Just as Apple solidly upstaged the announcements at CES for fifteen years, the iPhone maker has done the same to MWC over the last decade, despite Apple's initial position as a fledgling mobile maker among solidly entrenched incumbents.
While competitors have consistently announced ideas first, Apple is unique in being able to correctly envision what its customers will want, and then actually develop working, finished ideas it is then able to ship and, most importantly, sell to buyers in significant volumes.
Other companies, notably Samsung, had demonstrated promising ideas of grand visions of their own, but haven't had much success in actually selling those concepts. Overall, MWC vendors have outlined a broad range of ideas reaching into the premium space, but have largely only been able to perpetuate their miserable, unprofitable cycles of selling lower-end, largely unimaginative commodity products.
To clarify how likely it is that today's MWC announcements are going to have any real impact on Apple's operations or market position, take a look at the last ten years of Apple simply clobbering the entire gamut of the mobile industry. This is all despite year after year of MWC announcements that excited the media but failed to have much commercial or cultural impact at all.
In 2010, MWC officially honored Steve Jobs as its "mobile industry personality of the year." Apple was nowhere to be seen at the February trade show. Instead, Jobs had introduced Apple's then-new iPad at its own event in January.
Pundits had crapped all over iPad at its 2010 unveiling. Back then, I was interviewed by tech outlets who never published my interview because it didn't fit the narrative they were working to create —they only wanted to hear opinions of why iPad would fail.
Yet, just weeks later the same media sources were breathlessly excited to fantasize about the prospects of a series of things being shown at MWC 2010 that today are remembered as hilariously doomed failures.
These included Microsoft's finally-shipping Windows Phone 7, an attempt at rivaling Apple's iPhone, albeit three years late. "Every Windows Phone 7 Device is a Zune," PC World noted at the time, with no apparent awareness of the irony.
Pundits painted success as failure, and failure as success.
Beyond Microsoft, Google's Android was finally becoming a mass market option for phone makers. Yet as with the short and tortured existence of WP7, Apple's iOS was about to kill off the remains of Android's original originality.
At the time, Android was still a weird experiment stuck between its initial design created by Google—a button phone with a trackball for navigation—and its ultimate destiny as being little more than a means to knockoff the surface design of Apple's iPhones.
Another dead-end trend visible at MWC 2010: mini smartphones, seen in HTC's HD mini and the Palm Pixi Plus, as well as tiny phones attempted earlier by Nokia and Samsung. All of this sent pundits into an excited clamoring for more tiny phones. Why wasn't Apple making an iPhone mini? This was later answered when mini phones failed to sell.
Another big, exciting trend from MWC 2010 that is now forgotten history: the idea that Android licensees had the "freedom" to fashion their own innovative, proprietary UI appearances and behaviors on top of the Android foundation. Google once touted this as a feature of the platform before switching gears to advertise its own Nexus phones as "pure," stripped of the obnoxious crap licensees were ruining their products with.
Motorola showed phones with MotoBlur UI, while HTC showed the Desire, effectively a Google One with HTC's own Sense UI applied to it. This was supposed to make Android interesting and foster innovation, but really just confused users and fragmented their experience.
Sony Ericsson launched new Android and Symbian phones at MWC 2010, both with slide-out physical keyboards that nobody thinks of using anymore. At the time these were considered to be a feature Apple was missing. Were Android licensees too weak or incompetent to make their ideas stick, or was Apple just always right about its design decisions? It's hard to say.
Another notable idea from a decade ago: just as Android was beginning to take off, Samsung used MWC 2010 to make a "splashy" launch of Bada OS on its Wave handset. Bada was Samsung's new Linux-based OS that has since gone nowhere, but was intended to free Samsung from Google's control over Android. Why was Samsung already itching to leave Android?
"Highly confidential" internal documents revealed during Samsung's iPhone copycatting trial showed Samsung was worried about competitive threats in Google's partnership with HTC and its acquisition of Motorola.
Samsung's Bada initiative ultimately failed, as did Google's partnership with HTC and its acquisition of Motorola, and Intel and Nokia's MeeGo. Yet all along, pundits were desperately concerned with how Apple could possibly stay in business when facing the coordinated alliance of Android partners that were all marching in lockstep to kill the iPhone.
The reality was that Google and its Android licensees were all desperately paranoid and incompetent, plotting against each other and working at cross purposes. Did members of the media have no idea this was occurring, or did they cover this all up to create the illusion of Android being a world-leading, united competitor to Apple? Again, it's really hard to say whether they were ignorant or stupid.
One last idea from 2010 that sounds like a modern-day fantasy: think of a light, thin notebook running on a Snapdragon ARM chip, with integrated mobile data and an OLED touch display. That's what HP Compaq debuted in 2010 under the AirLife brand, which it called a smartbook.
Attendees sounded excited about this Android netbook, but it wasn't yet shipping and there was no price set yet. Nobody is using AirLife smartbooks today, and HP didn't weather the introduction of Apple's iPad very well.
In fact, within a few months, HP would buy Palm for its webOS and launch its own attempt at beating iPad using that new platform. That step cast doubt on the future of HP's Android phones and tablets, including the AirLife.
Interestingly, Davide Dicenso, a member of HP's Emerging Platforms Group that created the AirLife, noted that it was contention between HP and Google over its design that prompted HP to attempt to develop webOS as its own platform, independent from Google.
Over the next decade, these themes of adversarial contention, poorly conceived failed concepts, and ideological dogma kept resurfacing at MWC. It bamboozled attendees with products that would never matter while making grand claims about the future that weren't going to pan out.
In 2011, Apple again launched iPad 2 in January, prior to MWC, which was increasingly being taken over by Google. Motorola, which Google would later acquire, was showing off a series of products including the Xoom, Motorola's official Android 3.0 Honeycomb answer to Apple's iPad.
The Xoom was priced higher than Apple's iPad but Motorola was confident it would sell because it had more features, including the ability to connect to 4G networks.
Beyond Xoom—which would go down as one of the worst tablet failures ever hyped into the stratosphere with an incredible level of arrogance—Motorola was also showing off its new Atrix phone, which boasted 4G, a fingerprint sensor, and a dock connector that turned it into the brains of a netbook-like device running a Ubuntu Linux-based desktop—all features that Apple's iPhone lacked.
Only years later did iPhones get 4G support and Touch ID, which ended up major features that drove high volumes sales. Why didn't Atrix sell better? In part, its fingerprint sensor wasn't secure or reliable and ended up unsupported within the year, in part because Google acquired Motorola and dropped support for it. 4G mobile service, while very fast, initially only had limited coverage and early chipsets incurred significant drawbacks including battery life and a larger case.
Despite being commercial failures, the "features" of Xoom and Atrix bellowed huge clouds of distraction, including media narratives that included the important ability to run Adobe Flash content under Android Froyo, another thing iPhones couldn't do.
That wasn't so much "new phenomenon:" as it was a regurgitation of Microsoft's "Windows Everywhere" marketing of the 1990s. And notably, the idea that Windows code would someday power everyone's office equipment and home appliances had already failed miserably in a sea of incompatibilities, competitive contention, and security lapses. Accenture was begging the question of how Android was about to do the same thing, somehow with different consequences.
Ten years later, Android isn't "everywhere." It's really only on smartphones. On netbooks, TV appliances, game consoles, tablets and elsewhere, even Google is using code that isn't Android. And Google's top licensees, despite being unable to establish strong platforms of their own, are still trying to do so, from Samsung's Tizen SmartTVs and Gear watches and elsewhere.
MWC 2012 awarded its "best smartphone" award to Samsung's Galaxy SII, the closest copy of an iPhone anyone had dared to make. The best tablet went to Apple's iPad 2, which remained a no-show at the event.
Samsung really had no idea what people wanted. It told attendees it was also planning (in addition to last year's Bada and continuing efforts with Android) to roll out Windows Phone 8 models, and Windows 8 tablets. That's a lot of platforms to support.
Huawei was touting what it claimed were the fastest mobile chips: a smartphone powered by its custom K3V2 and a MediaPad tablet running a custom developed K3. Yet seven years later, Huawei today is positioned by media wonks as if it is a fresh startup springing into the market with advanced new processor tech straight from the communist party labs, rather than simply being a company that's been around forever and like every other Android licensee, couldn't sell its high-end devices, forcing it to focus on cheap, profitless commodity.
This failure is rebranded as winning because Huawei now serves the largest number of people looking for a cheap handset. But more importantly, that volume of cheap hardware hasn't created economies of scale capable of producing affordable, high-end processors the way Apple has.
Today, Apple's A12 Bionic in its newest iPhone and iPad Pro models are years ahead of Huawei—as well as being years ahead of Qualcomm, another company that used to have a solid lead in mobile chip technology.
The site was particularly excited about Windows Phone at Nokia, albeit sadly observing "Nokia's Windows Phone range is complete, now it's up to Microsoft." It also noted that Nokia was trying to compete with Microsoft Surface in the Windows tablet market.
It also hyped up Firefox OS, the Asus Padfone, Nvidia's Tegra 4 chip, and HP's Slate 7 Android tablet, all of which went nowhere. HP had given up on webOS and sold it to LG, but moving back to Android didn't turn its tablet prospects around.
You couldn't use Blackphone for email or run any Android apps though, or it would be as spyware-leaky as any other Android dripping with Google's custom-built and freely-shared surveillance advertising architecture.
By the end of 2014, Apple showed off its new Apple Watch, which went on sale the next spring. Despite dogging media efforts to denigrate its prospects, Apple absolutely destroyed the market for premium wearables, leaving rivals to once again spend their time building low margin, low-end devices that didn't really leave users satisfied, and subsequently didn't have any real market impact.
Samsung also rolled out its own Samsung Pay competing with Google's Android Pay to challenge Apple Pay. But after using various events to tout its Gear smartwatches, Samsung bowed out of smartwatches at MWC to wait for the launch of Apple Watch. Instead, it focused its attention on Gear VR, a way to experience binocular immersive images using a head-mounted smartphone.
HTC also worked to rival Apple's iPhone premium with its One M9 featuring a metal look and feel, and launched its own HTC Vive VR headset.
When Apple Watch launched a few days later at Apple's March 9 "Spring Forward" event, it ended up not having any competitors on its hands.
While the partnership between Facebook and Samsung got hyped up, it didn't deliver a promised new world of VR social networking. Instead, by the end of the year, Samsung flubbed up its Galaxy Note 7 battery fiasco so badly that its entire Gear VR headset strategy was thrown into question. And nobody apart from media personalities seemed interested in VR for more than 15 minutes anyway.
At the same show, LG announced its G5, with an internal expansion bay to make it "modular." It was a total flop. It also connected to VR. Google, HTC, Microsoft and Sony also invested big in VR, yet despite all of their combined efforts, VR ended 2016 being described as the biggest loser of the year.
Meanwhile, as the entire industry failed to deliver on VR hardware hype, Apple singlehandedly launched its very successful Apple Watch foray into wearables, while touting augmented reality as a larger opportunity. Pundits didn't predict either outcome.
In 2017, CNET provided a rundown of MWC that detailed a trip "back to the drawing board" with nostalgic designs. Simple phones from "Nokia" turned the once significant mobile maker into a licensed brand slapped on existing products, the same sort of humiliation suffered by Polaroid and Atari.
Blackberry unveiled its retro-design of the KeyOne, and Lenovo relaunched the Moto brand it bought from Google. Samsung didn't bring its Galaxy S8 to the show, instead choosing to launch it at its own event, Apple style. There were, however, protesters who interrupted Samsung's press conference to demand Samsung's plans for millions of recalled Note 7 batteries.
That push was driven by Qualcomm, which needed partners selling 5G as a feature iPhones lacked, given that Apple and Qualcomm had reached an impasse in chips. Without being able to articulate why 5G is important, the media narrative has erupted that its a big problem that Apple won't have 5G iPhones for the duration of 2019.
That hot take appears to have forgotten that iPhones lacked 4G for about three years, at a time when it faced more significant competition from Motorola and others pushing 4G connectivity. If Apple could hold out for years while 4G delivered a massive, clearly visible boost in mobile data speeds compared to saturated 3G networks, surely it can hold out on 5G in a year where nobody can really use it, and current phones aren't anywhere close to maxing out their existing potential.
"On the surface, the phone isn't all that different from the Galaxy S8, apart from a few small design tweaks like the fingerprint sensor being placed in a slightly more convenient spot," it noted. Galaxy S9 sales have performed poorly.
Appel's iPhone X, which was belabored as too expensive for most of its launch year, wasn't merely an aspirational halo device that sought to make Apple's other phones seem cool. It was Apple's most popular phone at launch. It was a mass market success that major media sources flat out lied about.
This year, despite desperate attempts to repeat that strategy of lying about Apple's "failure" until it sounded like reality, Apple's iPhone XS and XR models were all mass market sellers, and wildly profitable. And despite a slowdown in expected sales particularly in China, Apple still brought in massively more money than all of its competition combined, globally.
So rather than MWC headlines offering any real perspective on the industry, it really looks like a hype festival that's desperately trying to put a happy face on a series of companies that are desperately losing in the mobile arena to Apple, in conventional smartphones, in connected tablets, and in wearables.
That could change if Huawei, Samsung, and others create a real market for their ultra expensive folding phones. But given that they couldn't sell far more affordable phones, tablets, wearables, or VR, it's pretty clear that 5G folding phones are a huge phony cutout trying to distract from much larger problems.
A man in Portland, Ore., stole from that city's Apple Store on a nearly daily basis for several months, according to a probable-cause affidavit cited by Oregon Live. The man would wait for the store's guard to take a break, at which point he would run into the store, steal around $700 worth of Bose headphones or other merchandise, and run back out.
An Alaska man who worked as supervisor for the airline Ravn Alaska has been sentenced on federal charges that he abused his position to steal Apple computers bound for schools in Alaskan villages and then sold them. Breadoflife "Presley" Faiupu, according to the Justice Department statement, was sentenced to five years of probation, with six months of community confinement in a halfway house, in addition to restitution.
He's been charged with robbery, larceny, theft of a firearm, criminal use of a weapon, carrying a pistol without a permit, and breach of peace.
The notorious Mexican drug kingpin Joaquin "El Chapo" Guzman was convicted last week on ten separate federal counts, including narcotics trafficking, using a firearm in furtherance of his drug crimes and participating in a money laundering conspiracy. But the conviction won't stop Guzman's daughter from selling El Chapo 701-branded products, including iPhone accessories, Complex reported. The line also includes shirts, hats, and cigar accessories.
Guzman, while on the run in 2015, texted with an associate over whether to buy an iPhone 6, Samsung Galaxy S6 Edge, or the BlackBerry Leap. The drug lord's wife was caught sneaking an unauthorized cell phone into court during the trial in November, although it was never reported what model the phone was.
When he didn't pay, police were called.
Once an expensive niche option — and still that way, in some cases — CarPlay is becoming increasingly common on new cars, trucks, and SUVs, as well as aftermarket receivers. Here's a roundup of the introductions in 2018 and 2019, the latest being support in new Toyota trucks and SUVs.
Pricing and launch dates aren't yet ready, and the company hasn't said whether any models will support wireless CarPlay. That's unlikely though, since the feature is still rare industry-wide, and the only planned Toyota compatibility is in the 2020 Supra.
Volkswagen is meanwhile planning to add wireless CarPlay to the 2020 Passat, though it's unknown if the technology will make it to U.S. models.
Acura on Wednesday announced the 2019 ILX, its first version of the sedan with CarPlay, as well as Android Auto. Drivers will interact through an "enhanced" 7-inch capacitive touchscreen. The vehicle should reach dealerships in October.
Sony has meanwhile announced the XAV-AX210, a new 6.4-inch aftermarket receiver that supports CarPlay and Android Auto. It's actually an update of a 2017 model, the main new feature being support for iDatalink Maestro, an audio system that bridges wheels controls, amp functions, and onscreen car settings – but only when outside of CarPlay. Pricing and a North American release date will be revealed sometime this fall.
Toyota's burgeoning CarPlay lineup will soon include the 2019 Camry and Sienna, according to car shopping site CarsDirect. The information hasn't been announced publicly, but was uncovered by analysis of order guides. Interestingly, the vehicles may also support Amazon Alexa but not Android Auto, even though people will initially need an Android phone to make Alexa work. Alexa support for iPhone users is slated for early 2019.
September's Mazda CX-9 will begin at $32,280, but only have CarPlay standard in the Touring trim ($35,330) and above. That does also get owners an 8-inch screen, an upgrade from 7 inches on the base Sport.
Pioneer's new AVH-W4400NEX and AVH-W8400NEX receivers each support wireless CarPlay, still a rare commodity. The former ($699.99) has a 7-inch resistive touchscreen, while the latter ($1,199.99) switches to a capacitive screen, making it more responsive.
Perhaps following Toyota's lead, another CarPlay holdout — Mazda — revealed plans to add CarPlay to two upcoming vehicles, beginning with this summer's 2018 Mazda6. That car will only have the platform standard on Touring, Grand Touring, Grand Touring Reserve, and Signature trims, but displayed on an 8-inch screen.
Honda took the wraps off the 2019 Insight, saying the hybrid sedan will arrive this summer with CarPlay support through an "available" 8-inch dash interface. Toyota's Lexus division meanwhile said that its UX compact crossover, due in December, will have CarPlay standard.
The next Toyota to get CarPlay will be this summer's 2019 Corolla Hatchback, offering the technology on an 8-inch touchscreen. Pricing hasn't been revealed.
Acura's 2018 MDX Sport Hybrid has CarPlay standard on all trims, presented on a 7-inch capactive touchscreen. The vehicle starts at $52,100.
In 2015 Toyota infamously declared that it intended to stick with proprietary platforms for the foreseeable future, even as other automakers were preparing or already adding CarPlay. Apple's software began picking up traction in 2016 and is now on numerous vehicles, though availability on low-cost models remains an issue.
At CES Alpine showed off the CarPlay-compatible iLX-F309, due in February. The $1,100 receiver is distinguished by having a "floating" 9-inch WVGA touchscreen, allowing it to fit in vehicles that might not otherwise have enough dash space.
The app, Absher, is operated by the Saudi government and has innocuous purposes like paying parking fines, but can also be used to monitor and limit the travel activity of wives and daughters under a man's guardianship, even canceling those permissions entirely. Although Saudi Arabia has loosened some of its old policies toward women —for instance by letting them drive — the country remains very patriarchal.
Groups like Human Rights Watch and Amnesty International have expressed concern about Apple and Google's continued hosting of the app. Human Rights Watch in particular has suggested that the companies could simply ask Saudi Arabia to remove guardianship options and resubmit.
Casper, until now known for its mattresses, on Tuesday launched the Glow — a bedside sleep light with its own gesture and iPhone controls.
Physically resembling Apple's HomePod, the Glow's main feature is automatically adjusted color temperature. One gesture, for instance, will trigger a 45-minute transition from bright conventional lighting to a dim red before shutting off. On the flipside of sleep it can gradually wake owners up over the course of 30 minutes, using a time picked in a companion iPhone app. Functionally this is similar to smartbulbs by companies like Philips and LIFX.
The iPhone app also lets owners control power, pick from five preset modes, and sync multiple Glows together. So far Casper hasn't announced support for Apple HomeKit, Amazon Alexa, or any other third-party smarthome platforms.
Potentially aiding Qualcomm's trial defense against the U.S. Federal Trade Commission, Apple has admitted that for years, there was no other realistic option but Qualcomm when it wanted 4G modems for iPhones.
While the company considered alternatives like Broadcom, Ericsson, and Intel as far back as 2012, none of them could meet specifications, Apple's director of cellular systems architecture Matthias Sauer said in testimony on Jan. 18, as reported by Bloomberg. The company relied on Qualcomm 4G modems until 2016's iPhone 7.
Apple did consider using Intel for a 2014 iPad, Sauer added, but skipped the idea out of business reasons and a decision that it didn't need the specifications it had been looking for, such as carrier aggregation.
The FTC's lawsuit accuses Qualcomm of antitrust violations by forcing chip buyers to sign patent licenses at inflated rates. The Commission rested its case last week.
Qualcomm has defended its practices by a number of means, for example pointing to the high cost of innovation. Apple though has called the chipmaker's demands "onerous," at one point asking Apple to cross-license all its intellectual property to get a direct license for standards-essential patents, something Apple decided to skip.
Business Chat brings a "Chat with Messages" button to dealer sites, and tapping on it will connect with Gubagoo chat crews via the iOS Messages app. From there a person can browse car inventory, ask questions, and book appointments such as repairs or test drives.
While the average person may not know Gubagoo the company claims over 4,000 dealerships as clients, making it likely that online car shoppers have run into the company's platform. Until now that platform has been linked exclusively to the Web and Facebook.
Apple Business Chat expands on normal Messages functions so companies can support or sell to customers on iPhones and iPads. For Apple, at least part of the point is probably deflecting people away from Facebook Messenger, which not only offers similar services but is one of the world's most popular chat platforms in general, with the advantage of being cross-platform. Messages is only on iOS, watchOS, and macOS.
Stop us if you've heard this one. Apple makes some change to its iPhones, Samsung's PR company mocks the very idea —and finally Samsung copies it. Sometimes the company keeps a low profile, sometimes it shouts about Apple's missteps, but always, always Samsung then goes the same way.
We're not going to critcize Samsung phones here. Let's not even get into the argument that Android copied iOS —partly because yes, of course it did, but mostly because we want to specifically examine Samsung.
The company usually makes a case that its technology is ahead of Apple's and while you can regularly dispute that, it is often quite true. Samsung's phones were waterproof before the iPhone was, for instance, and later in 2019 it's highly likely that they will release 5G-capable phones and Apple won't.
What we can't get over is how Samsung's PR department keeps hammering on this same nail. As part of all this, it regularly lampoons people who buy iPhones as being deaf to Samsung's alleged technology superiority —but it treats its own users as being blind. Where Apple users sometimes get called sheep, Samsung is always hoping that its own users have goldfish memories.
The latest case is of course to do with the notch in the iPhone X range which naturally features far more prominently in Samsung's advertising than it does in Apple's own.
Yet this all goes back a long way. If it's usually in such a specific sequence that you could predict when Samsung will mock and how many months later it will copy, there are occasions when its PR company is just wilfully ignoring the facts in order to take a shot at Apple.
That was part of Samsung's series of ads called Ingenius which are all set in a mockup of Apple Stores and use, well, mockups of Apple Genius staff.
To be fair, Samsung could've done much the same thing with Microsoft Stores and would there have saved some money by not having to hire so many extras as customers.
We added the emphasis but we didn't enter our zip code—because there's nowhere to type it. We do hope that this is a fluke, some temporary hiccup, because each time we try, we see only this the page.
It's a gorgeously-designed page in the sense of how it looks but it doesn't actually work.
So Samsung is mocking the Apple Store experience when you didn't even know that there was a Samsung Experience Store. Shortly before it opened these shelves inside Best Buy, Samsung also ripped Apple apart for how the company changed from a 30-pin dock to a Lightning cable.
This was 2012 and when we're reminded that Apple made this change at all, it is startling to realise it was so long ago now. Samsung was right that it was happening and Samsung had a point about how big a change it was. To this day, you will find 30-pin connectors on devices in hotels, for instance.
That's apparently the fistful of different cables that you needed to charge all the variations of Samsung phones. In 2012, it was being sold as a 17-in-1 set and today it's an 18-in-1 set so either the makers missed one or Samsung's done it again —without Apple mocking them.
Call us idealistic, but we do credit customers with noticing things like this. We're idealistic but also practical, though, so we wouldn't assume that absolutely everybody would recognize a copy six years after the original. We do expect industry people too, however.
This one is Apple's version in 2007. Call it Before.
And in 2013, Samsung's After.
In that case, Samsung used Apple's advertising skill. In the cause of speed and efficiency, it skipped the bit where it first mocked Apple, it just went straight to using the ideas. This isn't the only time it's done that —see if you can spot any Apple-esque elements in this ad —but from around 2013, it kept quiet. For a while.
It's as if it believes both industry experts and its own customers are so siloed that they won't recognize a copy. They might well have a point there as usually Android advertising passes us by but we did pick up on Samsung's great online payment innovation.
And Samsung couldn't stop itself. While its advertising claimed that Samsung Pay was more widely accepted than any other system at all, it only showed an Apple Pay transaction failing. That claim about wide acceptance is qualified, by the way, with a little footnote saying "Refers to service coverage".
We're sure they're right and the fact that it initially only worked with then then new Galaxy S6 Edge+ and Note 5 is just a detail. And actually, Samsung Pay does have an advantage over its rivals in that can work with old-style payment machines where you had to swipe your card.
Maybe that gag about failed Apple Pay transaction emboldened Samsung's PR department, because it's since then that they've gone all out to ridicule their Cupertino rival.
Civilization ended in 2016. That was when Apple dropped the headphone jack with the introduction of the iPhone 7. It was such a cataclysmic event that it may have taken you until 2018 to get over it —only to have another of Samsung's Ingenius ads revive the trauma.
Take a guess what's happening now. It appears that Samsung's Galaxy A8S hasn't got a headphone jack either. We'll see what happens with the S10.
Someone at Samsung's PR department is clearly spotting genuine issues with Apple's iPhones, or at least things that could be genuine issues to some people. That dropping of the headphone jack was mildly inconvenient and it did mean we all have headphones lying around that we can't use any more. It was definitely a valid point.
We're just amused that nobody in Samsung's PR department talked to Samsung itself. Fortunately, though, they would never make that mistake twice.
Italy's anti-trust body fined Apple the equivalent of $11.4 million and Samsung only $5.7 million so maybe Samsung could claim a little higher moral ground. Except it didn't, it carried right on mocking how Apple iPhones slow down.
There's no disputing that it detracts from the otherwise edge to edge display on the iPhone X, XS, XS Max and XR. You might not mind it, but you know that it would be nicer if it weren't there. That said, you also know that it's necessary. The notch is where Apple puts its TrueDepth technology which powers the Face ID system.
Samsung can't let Apple be the only one with working Face ID so its new phones are set to have the same idea, at least to an extent. And in the case of the Samsung A8S, that same idea is going to feature what looks like a hole punch in the display.
It's up to you, it's up to each of us, whether we find that more distracting than a notch but the same thing applies. The display would be better without it.
And there's one other thing that you know applies. Apple is not going to mock Samsung's hole punch in its advertising.
We're going to say that, yes, Apple is too classy to hammer on Samsung in its major advertising campaigns. However, it's also smarter. Possibly it's also more arrogant, but it's definitely smarter.
Yet, the way that Samsung keeps on going through same loop of derision and copying leaves us feeling that it's an also-ran. That's wrong, Samsung makes some great phones yet this pummelling away at Apple is dangerous.
And having your ad agency insult the buyers of your rival's products doesn't feel like a winner, either. Maybe it is, maybe this is why Samsung is doing so well compared to all other Android makers.
Except of course that it's now copying Apple's China woes.


When Maria asks me if I want to come to Italy to fly a Tiger Moth from the 1930's - I'm not going to say no.
We stayed at the cutest little Bed&Breakfast just outside of Fano, and the older couple that rented our room out to us was so kind and friendly. They gave us maps and showed us where to go. I've never been to the east coast of Italy, so the first thing Maria and I decided to do (after enjoying a typical Italian breakfast) was to take our rental car to go see Fano town.
We didn't stay for long because we had other plans for that day - so after an hour or two we headed to an airfield not too far away where we met up with Cesare and Corrado. Together they fly the legendary open canopy Tiger Moth from 1930. They wanted our help to do their adventure of their lifetime - to participate in the Vintage Air Rally, where only 15 vintage airplanes will be selected to be part of this life-changing crazy trip that begins from the world's southernmost airport, Ushuaia, Argentina, and heading north to Florida, USA, journey's end.
Both Maria and I know what it's like to have a dream and thought that if we could help just a little bit with achieving theirs, then we're more than happy to do whatever it takes. The selection of which teams that will qualify is judged solely on popularity and likes on the Vintage Air Rally's Facebook Page, I ask everyone to give a big thump up by liking Cesare and Corrado's video on Facebook! I know it would make both of them so happy! 😀 Also, there's a flight giveaway!! One person of every 1000 that liked, commented or shared their video on the Vintage Air Rally's Facebook Page will get selected to get to fly with Corrado in the Tiger Moth!!
Flying the Tiger Moth was so much fun I couldn't stop smiling, THIS was truly something I've never experienced before and I'd love to do it over and over again. It's so different from anything I've ever flown before, such freedom feeling the wind with the open canopy. After our flight in the Tiger Moth we had a little break before our next adventure - skydiving.
Even though I've had the chance to try skydiving before with the Breitling team in Dijon, this was something completely different. We had the pleasure to jump out on an aircraft from 14000 feet (we normally use oxygen when at this altitude) while the sun was setting. It was SO beautiful to see the east coast of Italy at this altitude, and I was enjoying it so much more this time than the first time because I was feeling more relaxed.
During our last days in Abu Dhabi we stayed at the beautiful Ritz-Carlton hotel, which has the most stunning view over the Grand Mosque. Couldn't think of a better way of spending our last day in UAE than visiting this impressive landmark. From our balcony we had the green garden of the hotel and the mosque in the background, it was almost magical, so beautiful!! And to top that off the Al Bateen Executive Airport lies right next to the mosque so we could do some proper plane spotting with all the aircrafts coming on final approach for landing - all from our own balcony. A pilot's dream.
Thank you Ritz-Carlton in Abu Dhabi for your excellent service and helping us arrange everything, giving us an experience of a lifetime!


text:
"""
This file contains implementation of netconf interface for physical router
configuration manager
"""

from db import *
from dm_utils import DMUtils
from juniper_conf import JuniperConf
from juniper_conf import JunosInterface
from device_api.juniper_common_xsd import *

class MxConf(JuniperConf):
    _products = ['mx', 'vmx']

    def __init__(self, logger, params={}):
        self._logger = logger
        self.physical_router = params.get("physical_router")
        super(MxConf, self).__init__()
    # end __init__

    @classmethod
    def register(cls):
        mconf = {
              "vendor": cls._vendor,
              "products": cls._products,
              "class": cls
            }
        return super(MxConf, cls).register(mconf)
    # end register

    @classmethod
    def is_product_supported(cls, name, role):
        if role and role.lower().startswith('e2-'):
            return False
        for product in cls._products or []:
            if name.lower().startswith(product.lower()):
                return True
        return False
    # end is_product_supported

    def add_pnf_logical_interface(self, junos_interface):
        if not self.interfaces_config:
            self.interfaces_config = Interfaces(comment=DMUtils.interfaces_comment())
        family = Family(inet=FamilyInet(address=[Address(name=junos_interface.ip)]))
        unit = Unit(name=junos_interface.unit, vlan_id=junos_interface.vlan_tag, family=family)
        interface = Interface(name=junos_interface.ifd_name)
        interface.add_unit(unit)
        self.interfaces_config.add_interface(interface)
    # end add_pnf_logical_interface

    def config_pnf_logical_interface(self):
        pnf_dict = {}
        pnf_ris = set()
        # make it fake for now
        # sholud save to the database, the allocation
        self.vlan_alloc = {"max": 1}
        self.ip_alloc = {"max": -1}
        self.li_alloc = {}

        for pi_uuid in self.physical_router.physical_interfaces:
            pi = PhysicalInterfaceDM.get(pi_uuid)
            if pi is None:
                continue
            for pi_pi_uuid in pi.physical_interfaces:
                pi_pi = PhysicalInterfaceDM.get(pi_pi_uuid)
                for pi_vmi_uuid in pi_pi.virtual_machine_interfaces:
                    allocate_li = False
                    pi_vmi = VirtualMachineInterfaceDM.get(pi_vmi_uuid)
                    if (pi_vmi is None or
                            pi_vmi.service_instance is None or
                            pi_vmi.service_interface_type is None):
                        continue
                    if pi_vmi.routing_instances:
                        for ri_id in pi_vmi.routing_instances:
                            ri_obj = RoutingInstanceDM.get(ri_id)
                            if ri_obj and ri_obj.routing_instances and ri_obj.service_chain_address:
                                pnf_ris.add(ri_obj)
                                # If this service is on a service chain, we need allocate
                                # a logic interface for its VMI
                                allocate_li = True

                    if allocate_li:
                        resources = self.physical_router.allocate_pnf_resources(pi_vmi)
                        if (not resources or
                                not resources["ip_address"] or
                                not resources["vlan_id"] or
                                not resources["unit_id"]):
                            self._logger.error(
                                "Cannot allocate PNF resources for "
                                "Virtual Machine Interface" + pi_vmi_uuid)
                            return
                        logical_interface = JunosInterface(
                            pi.name + '.' + resources["unit_id"],
                            "l3", resources["vlan_id"], resources["ip_address"])
                        self.add_pnf_logical_interface(
                            logical_interface)
                        lis = pnf_dict.setdefault(
                            pi_vmi.service_instance,
                            {"left": [], "right": [],
                                "mgmt": [], "other": []}
                        )[pi_vmi.service_interface_type]
                        lis.append(logical_interface)

        return (pnf_dict, pnf_ris)
    # end

    def add_pnf_vrfs(self, first_vrf, pnf_dict, pnf_ris):
        is_first_vrf = False
        is_left_first_vrf = False
        for ri_obj in pnf_ris:
            if ri_obj in first_vrf:
                is_first_vrf = True
            else:
                is_first_vrf = False
            export_set = copy.copy(ri_obj.export_targets)
            import_set = copy.copy(ri_obj.import_targets)
            for ri2_id in ri_obj.routing_instances:
                ri2 = RoutingInstanceDM.get(ri2_id)
                if ri2 is None:
                    continue
                import_set |= ri2.export_targets

            pnf_inters = set()
            static_routes = self.physical_router.compute_pnf_static_route(ri_obj, pnf_dict)
            if_type = ""
            for vmi_uuid in ri_obj.virtual_machine_interfaces:
                vmi_obj = VirtualMachineInterfaceDM.get(vmi_uuid)
                if vmi_obj.service_instance is not None:
                    si_obj = ServiceInstanceDM.get(vmi_obj.service_instance)
                    if_type = vmi_obj.service_interface_type
                    pnf_li_inters = pnf_dict[
                        vmi_obj.service_instance][if_type]
                    if if_type == 'left' and is_first_vrf:
                        is_left_first_vrf = True
                    else:
                        is_left_first_vrf = False

                    for pnf_li in pnf_li_inters:
                        pnf_inters.add(pnf_li)

            if pnf_inters:
                vrf_name = self.physical_router.get_pnf_vrf_name(
                    si_obj, if_type, is_left_first_vrf)
                vrf_interfaces = pnf_inters
                ri_conf = { 'ri_name': vrf_name }
                ri_conf['import_targets'] = import_set
                ri_conf['export_targets'] = export_set
                ri_conf['interfaces'] = vrf_interfaces
                ri_conf['static_routes'] = static_routes
                ri_conf['no_vrf_table_label'] = True
                self.add_routing_instance(ri_conf)
    # end add_pnf_vrfs

    def add_static_routes(self, parent, static_routes):
        static_config = parent.get_static()
        if not static_config:
            static_config = Static()
            parent.set_static(static_config)
        for dest, next_hops in static_routes.items():
            route_config = Route(name=dest)
            for next_hop in next_hops:
                next_hop_str = next_hop.get("next-hop")
                preference = next_hop.get("preference")
                if not next_hop_str:
                    continue
                if preference:
                    route_config.set_qualified_next_hop(QualifiedNextHop(
                                     name=next_hop_str, preference=str(preference)))
                else:
                    route_config.set_next_hop(next_hop_str)
            static_config.add_route(route_config)
    # end add_static_routes

    def add_inet_public_vrf_filter(self, forwarding_options_config,
                                         firewall_config, inet_type):
        fo = Family()
        inet_filter = InetFilter(input=DMUtils.make_public_vrf_filter_name(inet_type))
        if inet_type == 'inet6':
            fo.set_inet6(FamilyInet6(filter=inet_filter))
        else:
            fo.set_inet(FamilyInet(filter=inet_filter))
        forwarding_options_config.add_family(fo)

        f = FirewallFilter(name=DMUtils.make_public_vrf_filter_name(inet_type))
        f.set_comment(DMUtils.public_vrf_filter_comment())
        ff = firewall_config.get_family()
        if not ff:
            ff = FirewallFamily()
            firewall_config.set_family(ff)
        if inet_type == 'inet6':
            inet6 = ff.get_inet6()
            if not inet6:
                inet6 = FirewallInet()
                ff.set_inet6(inet6)
            inet6.add_filter(f)
        else:
            inet = ff.get_inet()
            if not inet:
                inet = FirewallInet()
                ff.set_inet(inet)
            inet.add_filter(f)

        term = Term(name="default-term", then=Then(accept=''))
        f.add_term(term)
        return f
    # end add_inet_public_vrf_filter

    def add_inet_filter_term(self, ri_name, prefixes, inet_type):
        if inet_type == 'inet6':
            prefixes = DMUtils.get_ipv6_prefixes(prefixes)
        else:
            prefixes = DMUtils.get_ipv4_prefixes(prefixes)

        from_ = From()
        for prefix in prefixes:
            from_.add_destination_address(prefix)
        then_ = Then()
        then_.add_routing_instance(ri_name)
        return Term(name=DMUtils.make_vrf_term_name(ri_name),
                                        fromxx=from_, then=then_)
    # end add_inet_filter_term

    '''
     ri_name: routing instance name to be configured on mx
     is_l2:  a flag used to indicate routing instance type, i.e : l2 or l3
     is_l2_l3:  VN forwarding mode is of type 'l2_l3' or not
     import/export targets: routing instance import, export targets
     prefixes: for l3 vrf static routes and for public vrf filter terms
     gateways: for l2 evpn, bug#1395944
     router_external: this indicates the routing instance configured is for
                      the public network
     interfaces: logical interfaces to be part of vrf
     fip_map: contrail instance ip to floating-ip map, used for snat & floating ip support
     network_id : this is used for configuraing irb interfaces
     static_routes: this is used for add PNF vrf static routes
     no_vrf_table_label: if this is set to True will not generate vrf table label knob
     restrict_proxy_arp: proxy-arp restriction config is generated for irb interfaces
                         only if vn is external and has fip map
     highest_enapsulation_priority: highest encapsulation configured
    '''

    def add_routing_instance(self, ri_conf):
        ri_name = ri_conf.get("ri_name")
        vn = ri_conf.get("vn")
        is_l2 = ri_conf.get("is_l2", False)
        is_l2_l3 = ri_conf.get("is_l2_l3", False)
        import_targets = ri_conf.get("import_targets", set())
        export_targets = ri_conf.get("export_targets", set())
        prefixes = ri_conf.get("prefixes", [])
        gateways = ri_conf.get("gateways", [])
        router_external = ri_conf.get("router_external", False)
        interfaces = ri_conf.get("interfaces", [])
        vni = ri_conf.get("vni", None)
        fip_map = ri_conf.get("fip_map", None)
        network_id = ri_conf.get("network_id", None)
        static_routes = ri_conf.get("static_routes", {})
        no_vrf_table_label = ri_conf.get("no_vrf_table_label", False)
        restrict_proxy_arp = ri_conf.get("restrict_proxy_arp", False)
        highest_enapsulation_priority = \
                  ri_conf.get("highest_enapsulation_priority") or "MPLSoGRE"

        self.routing_instances[ri_name] = ri_conf
        ri_config = self.ri_config or RoutingInstances(comment=DMUtils.routing_instances_comment())
        policy_config = self.policy_config or PolicyOptions(comment=DMUtils.policy_options_comment())
        ri = Instance(name=ri_name)
        if vn:
            is_nat = True if fip_map else False
            ri.set_comment(DMUtils.vn_ri_comment(vn, is_l2, is_l2_l3, is_nat, router_external))
        ri_config.add_instance(ri)
        ri_opt = None
        if router_external and is_l2 == False:
            ri_opt = RoutingInstanceRoutingOptions(
                         static=Static(route=[Route(name="0.0.0.0/0",
                                                    next_table="inet.0",
                                                    comment=DMUtils.public_vrf_route_comment())]))
            ri.set_routing_options(ri_opt)

        # for both l2 and l3
        ri.set_vrf_import(DMUtils.make_import_name(ri_name))
        ri.set_vrf_export(DMUtils.make_export_name(ri_name))

        has_ipv6_prefixes = DMUtils.has_ipv6_prefixes(prefixes)
        has_ipv4_prefixes = DMUtils.has_ipv4_prefixes(prefixes)

        if not is_l2:
            if ri_opt is None:
                ri_opt = RoutingInstanceRoutingOptions()
                ri.set_routing_options(ri_opt)
            if prefixes and fip_map is None:
                static_config = ri_opt.get_static()
                if not static_config:
                    static_config = Static()
                    ri_opt.set_static(static_config)
                rib_config_v6 = None
                static_config_v6 = None
                for prefix in prefixes:
                    if ':' in prefix and not rib_config_v6:
                        static_config_v6 = Static()
                        rib_config_v6 = RIB(name=ri_name + ".inet6.0")
                        rib_config_v6.set_static(static_config_v6)
                        ri_opt.set_rib(rib_config_v6)
                    if ':' in prefix:
                        static_config_v6.add_route(Route(name=prefix, discard=''))
                    else:
                        static_config.add_route(Route(name=prefix, discard=''))
                    if router_external:
                        self.add_to_global_ri_opts(prefix)

            ri.set_instance_type("vrf")
            if not no_vrf_table_label:
                ri.set_vrf_table_label('')  # only for l3
            if fip_map is None:
                for interface in interfaces:
                    ri.add_interface(Interface(name=interface.name))
            if static_routes:
                self.add_static_routes(ri_opt, static_routes)
            family = Family()
            if has_ipv4_prefixes:
                family.set_inet(FamilyInet(unicast=''))
            if has_ipv6_prefixes:
                family.set_inet6(FamilyInet6(unicast=''))
            if has_ipv4_prefixes or has_ipv6_prefixes:
                auto_export = AutoExport(family=family)
                ri_opt.set_auto_export(auto_export)
        else:
            if highest_enapsulation_priority == "VXLAN":
                ri.set_instance_type("virtual-switch")
            elif highest_enapsulation_priority in ["MPLSoGRE", "MPLSoUDP"]:
                ri.set_instance_type("evpn")

        if fip_map is not None:
            if ri_opt is None:
                ri_opt = RoutingInstanceRoutingOptions()
                ri.set_routing_options(ri_opt)
            static_config = ri_opt.get_static()
            if not static_config:
                static_config = Static()
                ri_opt.set_static(static_config)
            static_config.add_route(Route(name="0.0.0.0/0",
                                          next_hop=interfaces[0].name,
                                          comment=DMUtils.fip_ingress_comment()))
            ri.add_interface(Interface(name=interfaces[0].name))

            public_vrf_ips = {}
            for pip in fip_map.values():
                if pip["vrf_name"] not in public_vrf_ips:
                    public_vrf_ips[pip["vrf_name"]] = set()
                public_vrf_ips[pip["vrf_name"]].add(pip["floating_ip"])

            for public_vrf, fips in public_vrf_ips.items():
                ri_public = Instance(name=public_vrf)
                ri_config.add_instance(ri_public)
                ri_public.add_interface(Interface(name=interfaces[1].name))

                ri_opt = RoutingInstanceRoutingOptions()
                ri_public.set_routing_options(ri_opt)
                static_config = Static()
                ri_opt.set_static(static_config)

                for fip in fips:
                    static_config.add_route(Route(name=fip + "/32",
                                                  next_hop=interfaces[1].name,
                                                  comment=DMUtils.fip_egress_comment()))

        # add policies for export route targets
        ps = PolicyStatement(name=DMUtils.make_export_name(ri_name))
        ps.set_comment(DMUtils.vn_ps_comment(vn, "Export"))
        then = Then()
        ps.add_term(Term(name="t1", then=then))
        for route_target in export_targets:
            comm = Community(add='',
                             community_name=DMUtils.make_community_name(route_target))
            then.add_community(comm)
        if fip_map is not None:
            # for nat instance
            then.set_reject('')
        else:
            then.set_accept('')
        policy_config.add_policy_statement(ps)

        # add policies for import route targets
        ps = PolicyStatement(name=DMUtils.make_import_name(ri_name))
        ps.set_comment(DMUtils.vn_ps_comment(vn, "Import"))
        from_ = From()
        term = Term(name="t1", fromxx=from_)
        ps.add_term(term)
        for route_target in import_targets:
            from_.add_community(DMUtils.make_community_name(route_target))
        term.set_then(Then(accept=''))
        ps.set_then(Then(reject=''))
        policy_config.add_policy_statement(ps)

        # add firewall config for public VRF
        forwarding_options_config = self.forwarding_options_config
        firewall_config = self.firewall_config
        if router_external and is_l2 == False:
            forwarding_options_config = (self.forwarding_options_config or
                                           ForwardingOptions(DMUtils.forwarding_options_comment()))
            firewall_config = self.firewall_config or Firewall(DMUtils.firewall_comment())
            if has_ipv4_prefixes and not self.inet4_forwarding_filter:
                #create single instance inet4 filter
                self.inet4_forwarding_filter = self.add_inet_public_vrf_filter(
                                                       forwarding_options_config,
                                                       firewall_config, "inet")
            if has_ipv6_prefixes and not self.inet6_forwarding_filter:
                #create single instance inet6 filter
                self.inet6_forwarding_filter = self.add_inet_public_vrf_filter(
                                                       forwarding_options_config,
                                                       firewall_config, "inet6")
            if has_ipv4_prefixes:
                #add terms to inet4 filter
                term = self.add_inet_filter_term(ri_name, prefixes, "inet4")
                # insert before the last term
                terms = self.inet4_forwarding_filter.get_term()
                terms = [term] + (terms or [])
                self.inet4_forwarding_filter.set_term(terms)
            if has_ipv6_prefixes:
                #add terms to inet6 filter
                term = self.add_inet_filter_term(ri_name, prefixes, "inet6")
                # insert before the last term
                terms = self.inet6_forwarding_filter.get_term()
                terms = [term] + (terms or [])
                self.inet6_forwarding_filter.set_term(terms)

        if fip_map is not None:
            firewall_config = firewall_config or Firewall(DMUtils.firewall_comment())
            f = FirewallFilter(name=DMUtils.make_private_vrf_filter_name(ri_name))
            f.set_comment(DMUtils.vn_firewall_comment(vn, "private"))
            ff = firewall_config.get_family()
            if not ff:
                ff = FirewallFamily()
                firewall_config.set_family(ff)
            inet = ff.get_inet()
            if not inet:
                inet = FirewallInet()
                ff.set_inet(inet)
            inet.add_filter(f)

            term = Term(name=DMUtils.make_vrf_term_name(ri_name))
            from_ = From()
            for fip_user_ip in fip_map.keys():
                from_.add_source_address(fip_user_ip)
            term.set_from(from_)
            term.set_then(Then(routing_instance=[ri_name]))
            f.add_term(term)

            term = Term(name="default-term", then=Then(accept=''))
            f.add_term(term)

            interfaces_config = self.interfaces_config or Interfaces(comment=DMUtils.interfaces_comment())
            irb_intf = Interface(name="irb")
            interfaces_config.add_interface(irb_intf)

            intf_unit = Unit(name=str(network_id),
                             comment=DMUtils.vn_irb_fip_inet_comment(vn))
            if restrict_proxy_arp:
                intf_unit.set_proxy_arp(ProxyArp(restricted=''))
            inet = FamilyInet()
            inet.set_filter(InetFilter(input=DMUtils.make_private_vrf_filter_name(ri_name)))
            intf_unit.set_family(Family(inet=inet))
            irb_intf.add_unit(intf_unit)

        # add L2 EVPN and BD config
        bd_config = None
        interfaces_config = self.interfaces_config
        proto_config = self.proto_config
        if (is_l2 and vni is not None and
                self.is_family_configured(self.bgp_params, "e-vpn")):
            ri.set_vtep_source_interface("lo0.0")
            if highest_enapsulation_priority == "VXLAN":
                bd_config = BridgeDomains()
                ri.set_bridge_domains(bd_config)
                bd = Domain(name=DMUtils.make_bridge_name(vni), vlan_id='none', vxlan=VXLan(vni=vni))
                bd.set_comment(DMUtils.vn_bd_comment(vn, "VXLAN"))
                bd_config.add_domain(bd)
                for interface in interfaces:
                     bd.add_interface(Interface(name=interface.name))
                if is_l2_l3:
                    # network_id is unique, hence irb
                    bd.set_routing_interface("irb." + str(network_id))
                ri.set_protocols(RoutingInstanceProtocols(
                               evpn=Evpn(encapsulation='vxlan', extended_vni_list='all')))
            elif highest_enapsulation_priority in ["MPLSoGRE", "MPLSoUDP"]:
                ri.set_vlan_id('none')
                if is_l2_l3:
                    # network_id is unique, hence irb
                    ri.set_routing_interface("irb." + str(network_id))
                evpn = Evpn()
                evpn.set_comment(DMUtils.vn_evpn_comment(vn, highest_enapsulation_priority))
                for interface in interfaces:
                     evpn.add_interface(Interface(name=interface.name))
                ri.set_protocols(RoutingInstanceProtocols(evpn=evpn))

            interfaces_config = self.interfaces_config or Interfaces(comment=DMUtils.interfaces_comment())
            if is_l2_l3:
                irb_intf = Interface(name='irb', gratuitous_arp_reply='')
                interfaces_config.add_interface(irb_intf)
                if gateways is not None:
                    intf_unit = Unit(name=str(network_id),
                                     comment=DMUtils.vn_irb_comment(vn, False, is_l2_l3))
                    irb_intf.add_unit(intf_unit)
                    family = Family()
                    intf_unit.set_family(family)
                    inet = None
                    inet6 = None
                    for (irb_ip, gateway) in gateways:
                        if ':' in irb_ip:
                            if not inet6:
                                inet6 = FamilyInet6()
                                family.set_inet6(inet6)
                            addr = Address()
                            inet6.add_address(addr)
                        else:
                            if not inet:
                                inet = FamilyInet()
                                family.set_inet(inet)
                            addr = Address()
                            inet.add_address(addr)
                        addr.set_name(irb_ip)
                        addr.set_comment(DMUtils.irb_ip_comment(irb_ip))
                        if len(gateway) and gateway != '0.0.0.0':
                            addr.set_virtual_gateway_address(gateway)

            self.build_l2_evpn_interface_config(interfaces_config, interfaces, vn)

        if (not is_l2 and not is_l2_l3 and gateways):
            interfaces_config = self.interfaces_config or Interfaces(comment=DMUtils.interfaces_comment())
            ifl_num = str(1000 + int(network_id))
            lo_intf = Interface(name="lo0")
            interfaces_config.add_interface(lo_intf)
            intf_unit = Unit(name=ifl_num, comment=DMUtils.l3_lo_intf_comment(vn))
            lo_intf.add_unit(intf_unit)
            family = Family()
            intf_unit.set_family(family)
            inet = None
            inet6 = None
            for (lo_ip, _) in gateways:
                subnet = lo_ip
                (ip, _) = lo_ip.split('/')
                if ':' in lo_ip:
                    if not inet6:
                        inet6 = FamilyInet6()
                        family.set_inet6(inet6)
                    addr = Address()
                    inet6.add_address(addr)
                    lo_ip = ip + '/' + '128'
                else:
                    if not inet:
                        inet = FamilyInet()
                        family.set_inet(inet)
                    addr = Address()
                    inet.add_address(addr)
                    lo_ip = ip + '/' + '32'
                addr.set_name(lo_ip)
                addr.set_comment(DMUtils.lo0_ip_comment(subnet))
            ri.add_interface(Interface(name="lo0." + ifl_num,
                                       comment=DMUtils.lo0_ri_intf_comment(vn)))

        # fip services config
        services_config = self.services_config
        if fip_map is not None:
            services_config = self.services_config or Services()
            services_config.set_comment(DMUtils.services_comment())
            service_name = DMUtils.make_services_set_name(ri_name)
            service_set = ServiceSet(name=service_name)
            service_set.set_comment(DMUtils.service_set_comment(vn))
            services_config.add_service_set(service_set)
            nat_rule = NATRules(name=service_name + "-sn-rule")
            service_set.add_nat_rules(NATRules(name=DMUtils.make_snat_rule_name(ri_name),
                                               comment=DMUtils.service_set_nat_rule_comment(vn, "SNAT")))
            service_set.add_nat_rules(NATRules(name=DMUtils.make_dnat_rule_name(ri_name),
                                               comment=DMUtils.service_set_nat_rule_comment(vn, "DNAT")))
            next_hop_service = NextHopService(inside_service_interface = interfaces[0].name,
                                              outside_service_interface = interfaces[1].name)
            service_set.set_next_hop_service(next_hop_service)

            nat = NAT(allow_overlapping_nat_pools='')
            nat.set_comment(DMUtils.nat_comment())
            services_config.add_nat(nat)
            snat_rule = Rule(name=DMUtils.make_snat_rule_name(ri_name),
                             match_direction="input")
            snat_rule.set_comment(DMUtils.snat_rule_comment())
            nat.add_rule(snat_rule)
            dnat_rule = Rule(name=DMUtils.make_dnat_rule_name(ri_name),
                             match_direction="output")
            dnat_rule.set_comment(DMUtils.dnat_rule_comment())
            nat.add_rule(dnat_rule)

            for pip, fip_vn in fip_map.items():
                fip = fip_vn["floating_ip"]
                term = Term(name=DMUtils.make_ip_term_name(pip))
                snat_rule.set_term(term)
                # private ip
                from_ = From(source_address=[pip + "/32"])
                term.set_from(from_)
                # public ip
                then_ = Then()
                term.set_then(then_)
                translated = Translated(source_prefix=fip + "/32",
                                        translation_type=TranslationType(basic_nat44=''))
                then_.set_translated(translated)

                term = Term(name=DMUtils.make_ip_term_name(fip))
                dnat_rule.set_term(term)

                # public ip
                from_ = From(destination_address=[fip + "/32"])
                term.set_from(from_)
                # private ip
                then_ = Then()
                term.set_then(then_)
                translated = Translated(destination_prefix=pip + "/32",
                                        translation_type=TranslationType(dnat_44=''))
                then_.set_translated(translated)

            interfaces_config = self.interfaces_config or Interfaces(comment=DMUtils.interfaces_comment())
            si_intf = Interface(name=interfaces[0].ifd_name,
                                comment=DMUtils.service_ifd_comment())
            interfaces_config.add_interface(si_intf)

            intf_unit = Unit(name=interfaces[0].unit,
                             comment=DMUtils.service_intf_comment("Ingress"))
            si_intf.add_unit(intf_unit)
            family = Family(inet=FamilyInet())
            intf_unit.set_family(family)
            intf_unit.set_service_domain("inside")

            intf_unit = Unit(name=interfaces[1].unit,
                             comment=DMUtils.service_intf_comment("Egress"))
            si_intf.add_unit(intf_unit)
            family = Family(inet=FamilyInet())
            intf_unit.set_family(family)
            intf_unit.set_service_domain("outside")

        self.forwarding_options_config = forwarding_options_config
        self.firewall_config = firewall_config
        self.policy_config = policy_config
        self.proto_config = proto_config
        self.interfaces_config = interfaces_config
        self.services_config = services_config
        self.route_targets |= import_targets | export_targets
        self.ri_config = ri_config
    # end add_routing_instance

    def build_l2_evpn_interface_config(self, interfaces_config, interfaces, vn=None):
        ifd_map = {}
        for interface in interfaces:
            ifd_map.setdefault(interface.ifd_name, []).append(interface)

        for ifd_name, interface_list in ifd_map.items():
            intf = Interface(name=ifd_name)
            interfaces_config.add_interface(intf)
            if interface_list[0].is_untagged():
                if (len(interface_list) > 1):
                    self._logger.error(
                        "invalid logical interfaces config for ifd %s" % (
                            ifd_name))
                    continue
                intf.set_encapsulation("ethernet-bridge")
                intf.add_unit(Unit(name=interface_list[0].unit,
                                   comment=DMUtils.l2_evpn_intf_unit_comment(vn, False),
                                   family=Family(bridge='')))
            else:
                intf.set_flexible_vlan_tagging('')
                intf.set_encapsulation("flexible-ethernet-services")
                for interface in interface_list:
                    intf.add_unit(Unit(name=interface.unit,
                               comment=DMUtils.l2_evpn_intf_unit_comment(vn,
                                                     True, interface.vlan_tag),
                               encapsulation='vlan-bridge',
                               vlan_id=str(interface.vlan_tag)))
    # end build_l2_evpn_interface_config

    def add_to_global_ri_opts(self, prefix):
        if not prefix:
            return
        if self.global_routing_options_config is None:
            self.global_routing_options_config = RoutingOptions(comment=DMUtils.routing_options_comment())
        static_config = Static()
        if ':' in prefix:
            rib_config_v6 = RIB(name='inet6.0')
            rib_config_v6.set_static(static_config)
            self.global_routing_options_config.add_rib(rib_config_v6)
        else:
            self.global_routing_options_config.add_static(static_config)
        static_config.add_route(Route(name=prefix, discard=''))
    # end add_to_global_ri_opts

    def set_route_targets_config(self):
        if self.policy_config is None:
            self.policy_config = PolicyOptions(comment=DMUtils.policy_options_comment())
        for route_target in self.route_targets:
            comm = CommunityType(name=DMUtils.make_community_name(route_target),
                                 members=route_target)
            self.policy_config.add_community(comm)
    # end set_route_targets_config

    def push_conf(self, is_delete=False):
        if not self.physical_router:
            return 0
        if is_delete:
            return self.send_conf(is_delete=True)
        if not self.physical_router.bgp_router:
            self._logger.info("bgp router not configured for pr: " + \
                                                 self.physical_router.name)
            return 0
        self.build_bgp_config()
        vn_dict = self.get_vn_li_map()
        self.physical_router.evaluate_vn_irb_ip_map(set(vn_dict.keys()), 'l2_l3', 'irb', False)
        self.physical_router.evaluate_vn_irb_ip_map(set(vn_dict.keys()), 'l3', 'lo0', True)
        vn_irb_ip_map = self.physical_router.get_vn_irb_ip_map()

        first_vrf = []
        pnfs = self.config_pnf_logical_interface()
        pnf_dict = pnfs[0]
        pnf_ris = pnfs[1]

        for vn_id, interfaces in vn_dict.items():
            vn_obj = VirtualNetworkDM.get(vn_id)
            if (vn_obj is None or
                    vn_obj.get_vxlan_vni() is None or
                    vn_obj.vn_network_id is None):
                continue
            export_set = None
            import_set = None
            for ri_id in vn_obj.routing_instances:
                # Find the primary RI by matching the name
                ri_obj = RoutingInstanceDM.get(ri_id)
                if ri_obj is None:
                    continue
                if ri_obj.fq_name[-1] == vn_obj.fq_name[-1]:
                    vrf_name_l2 = DMUtils.make_vrf_name(vn_obj.fq_name[-1],
                                                   vn_obj.vn_network_id, 'l2')
                    vrf_name_l3 = DMUtils.make_vrf_name(vn_obj.fq_name[-1],
                                                   vn_obj.vn_network_id, 'l3')
                    export_set = copy.copy(ri_obj.export_targets)
                    import_set = copy.copy(ri_obj.import_targets)
                    for ri2_id in ri_obj.routing_instances:
                        ri2 = RoutingInstanceDM.get(ri2_id)
                        if ri2 in pnf_ris:
                            first_vrf.append(ri2)
                        if ri2 is None:
                            continue
                        import_set |= ri2.export_targets

                    if vn_obj.get_forwarding_mode() in ['l2', 'l2_l3']:
                        irb_ips = None
                        if vn_obj.get_forwarding_mode() == 'l2_l3':
                            irb_ips = vn_irb_ip_map['irb'].get(vn_id, [])

                        ri_conf = { 'ri_name': vrf_name_l2, 'vn': vn_obj }
                        ri_conf['is_l2'] = True
                        ri_conf['is_l2_l3'] = (vn_obj.get_forwarding_mode() == 'l2_l3')
                        ri_conf['import_targets'] = import_set
                        ri_conf['export_targets'] = export_set
                        ri_conf['prefixes'] = vn_obj.get_prefixes()
                        ri_conf['gateways'] = irb_ips
                        ri_conf['router_external'] = vn_obj.router_external
                        ri_conf['interfaces'] = interfaces
                        ri_conf['vni'] = vn_obj.get_vxlan_vni()
                        ri_conf['network_id'] = vn_obj.vn_network_id
                        ri_conf['highest_enapsulation_priority'] = \
                                  GlobalVRouterConfigDM.global_encapsulation_priority
                        self.add_routing_instance(ri_conf)

                    if vn_obj.get_forwarding_mode() in ['l3', 'l2_l3']:
                        interfaces = []
                        lo0_ips = None
                        if vn_obj.get_forwarding_mode() == 'l2_l3':
                            interfaces = [
                                 JunosInterface(
                                'irb.' + str(vn_obj.vn_network_id),
                                'l3', 0)]
                        else:
                            lo0_ips = vn_irb_ip_map['lo0'].get(vn_id, [])
                        ri_conf = { 'ri_name': vrf_name_l3, 'vn': vn_obj }
                        ri_conf['is_l2_l3'] = (vn_obj.get_forwarding_mode() == 'l2_l3')
                        ri_conf['import_targets'] = import_set
                        ri_conf['export_targets'] = export_set
                        ri_conf['prefixes'] = vn_obj.get_prefixes()
                        ri_conf['router_external'] = vn_obj.router_external
                        ri_conf['interfaces'] = interfaces
                        ri_conf['gateways'] = lo0_ips
                        ri_conf['network_id'] = vn_obj.vn_network_id
                        self.add_routing_instance(ri_conf)
                    break

            if (export_set is not None and
                    self.physical_router.is_junos_service_ports_enabled() and
                    len(vn_obj.instance_ip_map) > 0):
                service_port_ids = DMUtils.get_service_ports(vn_obj.vn_network_id)
                if self.physical_router.is_service_port_id_valid(service_port_ids[0]) == False:
                    self._logger.error("DM can't allocate service interfaces for "
                                       "(vn, vn-id)=(%s,%s)" % (
                        vn_obj.fq_name,
                        vn_obj.vn_network_id))
                else:
                    vrf_name = DMUtils.make_vrf_name(vn_obj.fq_name[-1],
                                                 vn_obj.vn_network_id, 'l3', True)
                    interfaces = []
                    service_ports = self.physical_router.junos_service_ports.get(
                        'service_port')
                    interfaces.append(
                        JunosInterface(
                            service_ports[0] + "." + str(service_port_ids[0]),
                            'l3', 0))
                    interfaces.append(
                        JunosInterface(
                            service_ports[0] + "." + str(service_port_ids[1]),
                            'l3', 0))
                    ri_conf = { 'ri_name': vrf_name, 'vn': vn_obj }
                    ri_conf['import_targets'] = import_set
                    ri_conf['interfaces'] = interfaces
                    ri_conf['fip_map'] = vn_obj.instance_ip_map
                    ri_conf['network_id'] = vn_obj.vn_network_id
                    ri_conf['restrict_proxy_arp'] = vn_obj.router_external
                    self.add_routing_instance(ri_conf)
        # Add PNF ri configuration
        self.add_pnf_vrfs(first_vrf, pnf_dict, pnf_ris)
        self.set_as_config()
        self.set_route_targets_config()
        self.set_bgp_group_config()
        return self.send_conf()
    # end push_conf

# end PhycalRouterConfig

redpajama_set_name: RedPajamaGithub